mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
75 lines
2.7 KiB
TypeScript
75 lines
2.7 KiB
TypeScript
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
|
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
|
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
/// <reference path="Microsoft.Maps.d.ts"/>
|
|
|
|
declare module Microsoft.Maps {
|
|
|
|
/** GeoJSON object definition */
|
|
export interface IGeoJsonObject {
|
|
/**
|
|
* Type of the object
|
|
* could be one of the following:
|
|
* Point
|
|
* LineString
|
|
* Polygon
|
|
* MultiPoint
|
|
* MultiLineString
|
|
* MultiPolygon
|
|
* GeometryCollection
|
|
* Feature
|
|
* FeatureCollection
|
|
*/
|
|
type: string;
|
|
|
|
/** Geometric coordinates of the object */
|
|
coordinates?: number[] | number[][] | number[][][] | number[][][][];
|
|
|
|
/** Additional properties of the object as a key,value pair */
|
|
properties?: any;
|
|
|
|
/** Set of features (only applicable if the type is 'featurecollection') */
|
|
features?: IGeoJsonObject[];
|
|
|
|
/** Set of geometries (only applicable if the type is 'geometrycollection') */
|
|
geometries?: IGeoJsonObject[];
|
|
|
|
/** Geometry (only applicable if the type is 'feature') */
|
|
geometry?: IGeoJsonObject;
|
|
|
|
/** identifier of a feature (only applicable if the type is 'feature') */
|
|
id?: any;
|
|
}
|
|
|
|
/**
|
|
* Class responsible for reading/writing geo data in GeoJson format
|
|
* @requires The Microsoft.Maps.GeoJson module.
|
|
*/
|
|
export module GeoJson {
|
|
/**
|
|
* Reads the data from a given url and returns the shapes.
|
|
* @param url GeoJson download url.
|
|
* @param callback Callback function that needs to be called once the data is downloaded and parsed.
|
|
* @param jsonpQueryParam The name of the url query param to make a jsonp request.
|
|
* @param styles Styles that needs to be applied.
|
|
*/
|
|
export function readFromUrl(url: string, callback: (data: IPrimitive | IPrimitive[]) => void, jsonpQueryParam?: string, styles?: IStylesOptions): void;
|
|
|
|
/**
|
|
* Reads the data in geoJson format and returns the shapes.
|
|
* @param geoJson GeoJson data object that needs to be parsed into shapes.
|
|
* @param styles Styles that needs to be applied.
|
|
* @returns An array of shapes.
|
|
*/
|
|
export function read(geoJson: IGeoJsonObject | string, styles?: IStylesOptions): IPrimitive | IPrimitive[];
|
|
|
|
/**
|
|
* Writes the data into geoJson format.
|
|
* @param data Data that needs to be serialized.
|
|
* @returns A geoJson formatted string.
|
|
*/
|
|
export function write(data: IPrimitive | IPrimitive[]): IGeoJsonObject;
|
|
}
|
|
} |