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
addFeatureCollection
Adds a feature collection to the layer.
Parameters
Name | Required | Description |
---|---|---|
featureCollection | Yes | A GeoJSON FeatureCollection to be added to the layer. |
Example
var map = new Mapzania.Map("map-div", "AFRICA");
var features = {
type: "FeatureCollection",
features: [{
type: "Feature",
geometry: {
type: "LineString",
coordinates: [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]
},
properties: { streetName: "Markus Street", streetType: "mainroad" }
}]
};
map.usingNewLayer("MY_FEATURES")
.addFeatureCollection(features)
.update();