PostGIS example

13 views
Skip to first unread message

skylendar

unread,
Sep 10, 2011, 9:39:44 AM9/10/11
to tzdata history
I have downloaded the swiss shapefile from http://gadm.org, containing
the outline of Switzerland and its 26 cantons, and installed it with
shp2pgsql-gui.

Then, let's regard an example with the town of Sion (46N15 7E21, or
46.233 7.35 in decimal).

The following SQL statement will give you the canton in which Sion is
situated:

SELECT name_1 FROM "CHE_adm1" WHERE
ST_CoveredBy(ST_GeogFromText('SRID=4326;POINT(7.35 46.233)'), the_geom)
Reply all
Reply to author
Forward
0 new messages