Skip to main content

toJSON

Converts the geometry to a GeoJSON Feature object.

This method allows the geometry to be serialized to JSON and is automatically called by JSON.stringify().

geom.toJSON() is equivalent of calling toGeoJSON(geom, { flavor: 'extended', layout: 'XYZM' })

Returns

JSON_Feature<JSON_Geometry, P>

A GeoJSON Feature representation of this geometry

See also

  • toGeoJSON converts geometry to a GeoJSON Feature or a GeoJSON FeatureCollection object.

Examples