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
Methods
usingFeatureCollection
Gets a Query Object based on a A GeoJSON FeatureCollection provided by the user.
This object is a fluent object and can be used to chain method calls to the query as per the example below.
Parameters
Name | Required | Description |
---|---|---|
featureCollection | Yes | A GeoJSON FeatureCollection to be used in the query |
Example
var gjson = {
type: "FeatureCollection",
features: [...]
};
var qry = new Mapzania.QueryEngine();
qry.usingFeatureCollection(gjson)
.filterByText("Landlocked=='Y'")
.bufferGeometry(500)
.apply()
.then(function (data) {
console.log(data);
})
usingLayerSource
Gets a Query Object based on the key of the layer-source.
This object is a fluent object and can be used to chain method calls to the query as per the example below.
Parameters
Name | Required | Description |
---|---|---|
sourceKey | Yes | The key of the layer-source to be used in the query |
Example
var qry = new Mapzania.QueryEngine();
qry.usingLayerSource("COUNTRIES")
.filterByText("Landlocked=='Y'")
.bufferGeometry(500)
.apply()
.then(function (data) {
console.log(data);
})
usingMapLayer
Gets a Query Object based on a layer of an existing Map Object.
It is used specifically to run queries based on the layers of an existing Map Object without interfering with the map itself.
This object is a fluent object and can be used to chain method calls to the query as per the example below.
Parameters
Name | Required | Description |
---|---|---|
map | Yes | An existing Map Object |
layerKey | Yes | The key of the layer to be used in the query. |
options | No | An object for custom configuration of the map-layer query. The possible options are shown in the section below. |
Options
Name | Default | Description |
---|---|---|
useFilters | true | If set to true, the query will take into consideration any filters that have been applied to the map layer. |
useState | true | If set to true, the query will take into consideration the state of the map layer. This includes any client-side features that have been added to the layer as well as whether the layer is visible or not. |
Example
var map = new Mapzania.Map("map-div", "LONDON", function () {
var qry = new Mapzania.QueryEngine();
qry.usingMapLayer(map, "WARD", {
useState: false,
useFilters: true
})
.convertToCentroids()
.apply()
.then(function (data) {
console.log(data);
});
});