> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/st_geomfromgeojson.md).

# ST\_GeomFromGeoJSON

## Syntax

```bnf
ST_GeomFromGeoJSON(g[, option])
```

## Description

Given a GeoJSON input *g*, returns a geometry object. The *option* specifies what to do if *g* contains geometries with coordinate dimensions higher than 2.

| Option | Description                                                                                      |
| ------ | ------------------------------------------------------------------------------------------------ |
| 1      | Return an error (the default)                                                                    |
| 2 - 4  | The document is accepted, but the coordinates for higher coordinate dimensions are stripped off. |

## Examples

```sql
SET @j = '{ "type": "Point", "coordinates": [5.3, 15.0]}';

SELECT ST_AsText(ST_GeomFromGeoJSON(@j));
+-----------------------------------+
| ST_AsText(ST_GeomFromGeoJSON(@j)) |
+-----------------------------------+
| POINT(5.3 15)                     |
+-----------------------------------+
```

## See Also

* [ST\_AsGeoJSON](/docs/server/reference/sql-statements/geometry-constructors/geometry-constructors/geojson-st_asgeojson.md)

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
