Created
January 12, 2023 02:10
-
-
Save rkaneko/084237b2846839d35c1f565395c5a5fd to your computer and use it in GitHub Desktop.
PostGIS query to convert FeatureCollection GeoJSON into MultiPolygon GeoJSON
This file contains hidden or 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
WITH original AS ( | |
SELECT | |
ST_Collect(ST_ShiftLongitude(ST_GeomFromGeoJSON(feat->>'geometry'))) geom | |
FROM (SELECT json_array_elements('HERE_IS_FEATURE_COLLECTION_GEOJSON'::json->'features') AS feat) AS f | |
) | |
SELECT ST_AsGeoJSON(o.geom) FROM original o LIMIT 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment