Skip to content

Instantly share code, notes, and snippets.

@nautilytics
Created February 11, 2021 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nautilytics/3b5e5b54a3b128332e1d4dea2e81d781 to your computer and use it in GitHub Desktop.
Save nautilytics/3b5e5b54a3b128332e1d4dea2e81d781 to your computer and use it in GitHub Desktop.
Create a GeoJSON of the Countries Surrounding the Disputed India Boundary
COPY
(
SELECT row_to_json(fc) AS json_out
FROM (
SELECT 'FeatureCollection' AS type,
array_to_json(array_agg(f)) AS features
FROM (
SELECT 'Feature' AS type,
st_asgeojson(st_transform(st_union(b.geom), 4326))::json AS geometry,
ROW_TO_JSON(
(SELECT l
FROM
(SELECT b.iso_a3 AS "ISO_A3") AS l)) AS properties
FROM ne_10m_admin_0_countries b
JOIN india_boundary a ON ST_Intersects(a.geom, b.geom)
WHERE NOT ADMIN = 'India'
GROUP BY b.iso_a3
) f) fc ) TO '/Users/<user_name>/Desktop/india-surrounding-differences.json';
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment