JS API
- Parameters
- Options
- Example
- Methods
- fitToBoundingBox
- getBoundingBox
- getInitialBoundingBox
- getLayers
- getMouseMode
- off
- on
- once
- refresh
- reset
- setMouseMode
- usingLayer
- usingNewLayer
- Events
- Parameters
- Example
- Methods
- addFeature
- addFeatureCollection
- bringForwards
- bufferGeometry
- changeProperties
- clearFilters
- clearFeatures
- clearStyle
- clipByFeatureCollection
- convertToCentroids
- filterByBoundingBox
- filterByFeatureCollection
- filterByNearest
- filterByText
- getFeatureCollection
- hide
- sendBackwards
- show
- style
- update
- usingFeature
GeoJson Creation
createFeatureCollection
Creates a GeoJSON FeatureCollection object.
Parameters
Name | Required | Description |
---|---|---|
source | No | If source is not set, the FeatureCollection will be empty. Also accepts a FeatureCollection, an array of Features or a single Feature. |
createFeature
Creates a GeoJSON Feature object.
Parameters
Name | Required | Description |
---|---|---|
geometry | Yes | The GeoJSON geometry object of the feature. |
properties | No | The properties object of the feature. If not set, the properties object will be an empty object. |
id | No | The id of the feature. Undefined if not set. |
createPoint
Creates a GeoJSON Point geometry object.
Parameters
Name | Required | Description |
---|---|---|
param1 | Yes | Either a coordinate array of two values ([x,y]) or a numeric x-value. |
param2 | No | If param1 is a numeric x-value, param2 is a numeric y-value |
Example
var gjson = Mapzania.GeoJson.createPoint([20.33, 30.64]);
var gjson = Mapzania.GeoJson.createPoint(20.33, 30.64);
createMultiPoint
Creates a GeoJSON MultiPoint geometry object.
Parameters
Name | Required | Description |
---|---|---|
coordinates | Yes | The GeoJSON coordinates of the MultiPoint. |
Example
var gjson = Mapzania.GeoJson.createMultiPoint([[20.33, 30.64],[16.23, 21.59]]);
createLineString
Creates a GeoJSON LineString geometry object.
Parameters
Name | Required | Description |
---|---|---|
coordinates | Yes | The GeoJSON coordinates of the LineString. |
Example
var gjson = Mapzania.GeoJson.createLineString([[20.33, 30.64],[16.23, 21.59]]);
createMultiLineString
Creates a GeoJSON MultiLineString geometry object.
Parameters
Name | Required | Description |
---|---|---|
coordinates | Yes | The GeoJSON coordinates of the MultiLineString. |
Example
var gjson = Mapzania.GeoJson.createMultiLineString([[[20.33, 30.64],[16.23, 21.59]],[[12.43, 41.22],[19.87, 32.43]]]);
createPolygon
Creates a GeoJSON Polygon geometry object.
Parameters
Name | Required | Description |
---|---|---|
coordinates | Yes | The GeoJSON coordinates of the Polygon or a bounding box coordinate array. |
Example
var gjson = Mapzania.GeoJson.createPolygon([[[20.33, 30.64],[16.23, 21.59],[20.33, 30.64]],[[12.43, 41.22],[19.87, 32.43],[12.43, 41.22]]]);
var gjson = Mapzania.GeoJson.createPolygon([12.1, 3.4, 14.3, 4.2]);
createMultiPolygon
Creates a GeoJSON MultiPolygon geometry object.
Parameters
Name | Required | Description |
---|---|---|
coordinates | Yes | The GeoJSON coordinates of the MultiPolygon. |
Example
var gjson = Mapzania.GeoJson.createMultiPolygon([[[[20.33, 30.64],[16.23, 21.59],[20.33, 30.64]],[[12.43, 41.22],[19.87, 32.43],[12.43, 41.22]]],[[[20.33, 30.64],[16.23, 21.59],[20.33, 30.64]],[[12.43, 41.22],[19.87, 32.43],[12.43, 41.22]]]]);