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
addFeature
Adds a feature to the layer.
Parameters
Name | Required | Description |
---|---|---|
feature | Yes | A GeoJSON Feature to be added to the layer. |
Example
var map = new Mapzania.Map("map-div", "AFRICA");
var feature = {
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")
.addFeature(feature)
.update();