geometry | feature_id |
---|---|
POINT(102 0.5) | 1 |
LINESTRING(102 0,103 1,104 0,105 1) | 2 |
Last active
November 1, 2016 20:25
-
-
Save dbazile/3d5c2d16d04305dc159ebbab42cbb2c4 to your computer and use it in GitHub Desktop.
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 ST_AsText(ST_GeomFromGeoJSON(fc.features->>'geometry')) AS geometry, | |
row_number() OVER () AS feature_id | |
FROM (SELECT json_array_elements('{ | |
"type": "FeatureCollection", | |
"features": [ | |
{ | |
"type": "Feature", | |
"geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, | |
"properties": {"prop0": "value0"} | |
}, | |
{ | |
"type": "Feature", | |
"geometry": { | |
"type": "LineString", | |
"coordinates": [ | |
[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0] | |
] | |
}, | |
"properties": { | |
"prop0": "value0", | |
"prop1": 0.0 | |
} | |
} | |
] | |
}'::json->'features') AS features) fc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment