Working with Documents in GeoJSON
Explore how to work with GeoJSON documents in MySQL by converting them into spatial entities using ST_GeomFromGeoJSON and reversing the process with ST_AsGeoJSON. Understand geometry types, feature collections, and coordinate reference systems for effective geospatial data handling and analysis.
We'll cover the following...
GeoJSON is a geospatial data interchange format based on JSON. It was developed for encoding various geographic data structures, including geometry types such as Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon. Additionally, GeoJSON supports Feature objects, which are geometric objects with additional properties, and FeatureCollection objects, which are sets of Feature. An example of such geometry types is a GeoJSON document like the following:
The GeoJSON document contains multiple attributes describing the represented spatial entities:
The document’s type is
FeatureCollection, i.e., the document is a set ofFeature(line 2).The
FeatureCollectionoperates under a specific coordinate reference system (crs), defined as the spatial reference system (SRS) with the ID 3857 (lines 4–9).The various features within this collection are enumerated ...