Last active
June 23, 2021 11:47
-
-
Save torgeir/d117ec66b7eaa8b4b83cac6eebf8ab1a to your computer and use it in GitHub Desktop.
Geojson with properties, extracted from bigquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"json": "{\"type\":\"MultiLineString\",\"coordinates\":\"[[[11.36588,61.13079], ... , [11.007229,61.572116]]]\",\"properties\":{\"description\":\"Stengt på grunn ... . \"}}" | |
}, | |
... | |
{ | |
"json": "{\"type\":\"LineString\",\"coordinates\":\"[[10.402729,62.429979], ... ,[10.335529,62.561779]]\",\"properties\":{\"description\":\"Stengt på grunn ... .\"}}" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
TO_JSON_STRING(t) as json | |
FROM | |
(SELECT | |
JSON_VALUE(geojson, "$.type") as type, | |
JSON_QUERY(geojson, "$.coordinates") as coordinates, | |
STRUCT(description) as properties | |
FROM | |
(SELECT | |
ST_ASGEOJSON(correctedGeography) geojson, | |
description | |
FROM `dataset.table` | |
LIMIT 10)) as t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment