Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Switch services using the Version drop-down list. Learn more about navigation.
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Converts Well-known text (WKT) string to GeoJSON shape.
Syntax
geo_from_wkt(wkt)
Learn more about syntax conventions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| wkt | string |
✔️ | Well-known text representation string of geometry. |
Returns
Shape in GeoJSON Format and of a dynamic data type. If the input WKT string is invalid or unsupported, the query produces a null result.
Note
The geospatial coordinates are interpreted as represented by the WGS-84 coordinate reference system.
Tip
- Using converted and stored GeoJSON shapes may result in better performance in geospatial analysis.
Examples
The following example converts point from WKT format to GeoJSON format.
print point = geo_from_wkt("POINT (1 2)");
Output
| point |
|---|
| {"type": "Point","coordinates": [1,2]} |
The following example converts line from WKT format to GeoJSON format.
print line = geo_from_wkt("LINESTRING (1 2, 3 4)");
Output
| line |
|---|
| {"type": "LineString", "coordinates": [[1,2],[3,4]]} |
The following example converts polygon from WKT format to GeoJSON format
print polygon = geo_from_wkt("POLYGON ((0 0, 2 0, 2 2, 0 0))");
Output
| polygon |
|---|
| {"type": "Polygon","coordinates": [[[0,0],[2,0],[2,2],[0,0]]]} |
The following example converts multipoint from WKT format to GeoJSON format.
print multipoint = geo_from_wkt("MULTIPOINT (1 1, 2 2, 3 3)");
Output
| multipoint |
|---|
| {"type": "MultiPoint","coordinates": [[1,1],[2,2],[3,3]]} |
The following example converts multiline from WKT format to GeoJSON format.
print multiline = geo_from_wkt("MULTILINESTRING ((1 1, 2 2, 3 3), (4 4, 5 5))");
Output
| multiline |
|---|
| {"type":"MultiLineString","coordinates":[[[1,1],[2,2],[3,3]],[[4,4],[5,5]]]} |
The following example converts multipolygon from WKT format to GeoJSON format.
print multipolygon = geo_from_wkt("MULTIPOLYGON (((0 0, 2 0, 2 2, 0 0)),((10 10, 12 10, 12 12, 10 10)))");
Output
| multipolygon |
|---|
| {"type": "MultiPolygon","coordinates": [[[[0,0],[2,0],[2,2],[0,0]]],[[[10,10],[12,10],[12,12],[10,10]]]]} |
The following example converts geometry collection from WKT format to GeoJSON format.
print geometry_collection = geo_from_wkt("GEOMETRYCOLLECTION (POINT (1 1),LINESTRING (2 2, 3 3, 4 4),POLYGON ((10 10, 12 10, 12 12, 10 10)))");
Output
| geometry_collection |
|---|
| {"type":"GeometryCollection","geometries":[{"type":"Point","coordinates":[1,1]},{"type":"LineString","coordinates":[[2,2],[3,3],[4,4]]},{"type":"Polygon","coordinates":[[[10,10],[12,10],[12,12],[10,10]]]}]} |
The following example returns a null result because of the invalid WKT string.
print result = isnull(geo_from_wkt("LINESTRING"))
Output
| result |
|---|
| true |