Class GeoJsonFeatureCollection
Accessors
geoJsons
-
Returns object
-
features: any[]
-
type: string
Methods
addGeoJson
-
Parameters
Returns void
addGeoJsons
-
Parameters
Returns void
removeAll
-
Returns void
removeById
- removeById(id: string): void
-
Parameters
Returns void
Class containing several GeoJson features. Basic methods for adding and deleting them.
Features support stroke and stroke color like:
How to use the GeoJson interfaces and clases.
// Create new collection const geoJsonCollection: GeoJsonFeatureCollection = new GeoJsonFeatureCollection(); const geoJson: IGeoJsonFeature = { id: 1, feature: { type: 'Feature', properties: { stroke: [85, 55, 55], 'stroke-width': 2, }, geometry: { type: 'LineString', coordinates: [ [ -103.09432983398436, 20.873568860790446, ], [ -103.4857177734375, 20.548580033472923, ], ], }, }, } // Add geoJson to collection. geoJsonCollection.addGeoJson(geoJson); // You will usually add the GeoJson to a map: map.addGeoJson(geoJson)