spatial.wktToGeoJson
Function
Converts a WKT to GeoJson structure
Examples
1. Converts a WKT POINT
RETURN spatial.wktToGeoJson('POINT (30 10)') as json
json |
---|
|
2. Converts a WKT LINESTRING
RETURN spatial.wktToGeoJson('LINESTRING (30 10, 10 30, 40 40)') as json
json |
---|
|
3. Converts a WKT POLYGON
RETURN spatial.wktToGeoJson('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))') as json
json |
---|
|
4. Converts a WKT POLYGON with a hole
RETURN spatial.wktToGeoJson('POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))') as json
json |
---|
|
5a. Converts a WKT MULTIPOINT
RETURN spatial.wktToGeoJson('MULTIPOINT ((10 40), (40 30), (20 20), (30 10))') as json
json |
---|
|
5b. Converts a WKT MULTIPOINT
RETURN spatial.wktToGeoJson('MULTIPOINT (10 40, 40 30, 20 20, 30 10)') as json
json |
---|
|
6. Converts a WKT MULTILINESTRING
RETURN spatial.wktToGeoJson('MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))') as json
json |
---|
|
7a. Converts a WKT MULTIPOLYGON
RETURN spatial.wktToGeoJson('MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)), ((15 5, 40 10, 10 20, 5 10, 15 5)))') as json
json |
---|
|
7b. Converts a WKT MULTIPOLYGON
RETURN spatial.wktToGeoJson('MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20)))') as json
json |
---|
|
8. FConverts a WKT GEOMETRYCOLLECTION
RETURN spatial.wktToGeoJson('GEOMETRYCOLLECTION (POINT (40 10), LINESTRING (10 10, 20 20, 10 40), POLYGON ((40 40, 20 45, 45 30, 40 40)))') as json
json |
---|
|