content_image/732340.jpg
options , if given, describes how to handle GeoJSON documents that contain geometries with coordinate dimensions higher than 2. The following table shows the permitted options  values. 

<img src='content_image/732340.jpg'>

options  values of 2, 3, and 4 currently produce the same effect. If geometries with coordinate dimensions higher than 2 are supported in the future, you can expect these values to produce different effects. 

The srid  argument, if given, must be a 32-bit unsigned integer. If not given, the geometry return value has an SRID of 4326. 

If srid  refers to an undefined spatial reference system (SRS), an ER_SRS_NOT_FOUND  error occurs. 

For geographic SRS geometry arguments, if any argument has a longitude or latitude that is out of range, an error occurs: 

• If a longitude value is not in the range ( − 180, 180], an ER_LONGITUDE_OUT_OF_RANGE  error occurs. 

• If a latitude value is not in the range [ − 90, 90], an ER_LATITUDE_OUT_OF_RANGE  error occurs. 

Ranges shown are in degrees. If an SRS uses another unit, the range uses the corresponding values in its unit. The exact range limits deviate slightly due to floating-point arithmetic. 

GeoJSON geometry, feature, and feature collection objects may have a crs  property. The parsing function parses named CRS URNs in the urn:ogc:def:crs:EPSG:: srid  and EPSG: srid namespaces, but not CRSs given as link objects. Also, urn:ogc:def:crs:OGC:1.3:CRS84  is recognized as SRID 4326. If an object has a CRS that is not understood, an error occurs, with the exception that if the optional srid  argument is given, any CRS is ignored even if it is invalid. 

If a crs  member that specifies an SRID different from the top-level object SRID is found at a lower level of the GeoJSON document, an ER_INVALID_GEOJSON_CRS_NOT_TOP_LEVEL  error occurs. 

As specified in the GeoJSON specification, parsing is case-sensitive for the type  member of the GeoJSON input ( Point , LineString , and so forth). The specification is silent regarding case sensitivity for other parsing, which in MySQL is not case-sensitive. 

This example shows the parsing result for a simple GeoJSON object. Observe that the order of coordinates depends on the SRID used. 

mysql> SET @json = ’{ "type": "Point", "coordinates": [102.0, 0.0]}’; mysql> SELECT ST_AsText(ST_GeomFromGeoJSON(@json)); +--------------------------------------+ | ST_AsText(ST_GeomFromGeoJSON(@json)) | +--------------------------------------+ | POINT(0 102) | +--------------------------------------+ mysql> SELECT ST_SRID(ST_GeomFromGeoJSON(@json)); +------------------------------------+ | ST_SRID(ST_GeomFromGeoJSON(@json)) | +------------------------------------+ | 4326 | 

