Last active
December 31, 2015 18:49
-
-
Save etaque/8029082 to your computer and use it in GitHub Desktop.
How to load world coasts data into PostGIS and query into
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
| Download "Format: Shapefile, Projection: WGS84 (Large polygons are split, use for larger scales)" from: | |
| http://openstreetmapdata.com/data/land-polygons | |
| Import into PG database with PostGIS extension: | |
| shp2pgsql -s 4326 land_polygons.shp | psql <database> | |
| Add index: | |
| CREATE INDEX idx_land_polygons_geom ON land_polygons USING gist(geom); | |
| Query example: | |
| select (count(*) > 0) as aground from land_polygons WHERE st_contains(geom, ST_GeomFromText('POINT(3.007813 46.759292)', 4326)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment