Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GeoJsonFeatureCollection

Class containing several GeoJson features. Basic methods for adding and deleting them.

Features support stroke and stroke color like:

{
     feature: {
         type: 'Feature',
         properties: {
             stroke: [85, 55, 55],
             'stroke-width': 2,
         },
         geometry: {
             type: 'LineString',
             coordinates: [
                 [-103.09432983398436,20.873568860790446,],
                 [-103.4857177734375,20.548580033472923,],
             ],
         },
     }
}

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)

Hierarchy

  • GeoJsonFeatureCollection

Index

Accessors

geoJsons

  • get geoJsons(): object
  • Returns object

    • features: any[]
    • type: string

Methods

addGeoJson

  • Adds one {@link GeoJsonFeature} to the colletion.

    Parameters

    Returns void

addGeoJsons

  • Adds multiple {@link GeoJsonFeatures} to the colletion.

    Parameters

    Returns void

removeAll

  • removeAll(): void
  • Removes all geoJsons at once.

    Returns void

removeById

  • removeById(id: string): void
  • Removes {@link GeoJsonFeature} from collection by Id.

    Parameters

    • id: string

      's id to be deleted.

    Returns void

Generated using TypeDoc