Skip to content

Instantly share code, notes, and snippets.

@parkercoleman
Last active December 10, 2015 04:30
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 parkercoleman/51cd5efca20d430ac5b7 to your computer and use it in GitHub Desktop.
Save parkercoleman/51cd5efca20d430ac5b7 to your computer and use it in GitHub Desktop.
Maptime Seattle Postgis - Problem 4
SELECT p.name, MIN(ST_Distance(p.geom, c.geom, true)) * 0.000621371 AS distance_miles
FROM transport.ports_ne p
CROSS JOIN geo.coastline_ne c
WHERE ST_Within(p.geom, (SELECT geom FROM geo.countries_ne WHERE admin = 'United States of America'))
GROUP BY p.name
ORDER BY distance_miles DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment