[postgis-users] Importing timezone shape files - newbie

Nicolas Ribot nicolas.ribot at gmail.com
Thu Apr 5 01:27:30 PDT 2012


> Hi all,
>
> I'm using PG 9.1.3 with pgAdmin 1.14.2 on Windows 7 Home Edition to
> get familiar with PostGIS and TimeZone data.
> PostGIS 1.5.3 is installed and the postgis database was created by the
> installer.
>
> My immediate end goal is to be able to take a Lat/Lon and query PG to
> find the correct time zone for the location.
>
> I installed the "PostGIS Shapefile and DBF loader" plugin in pgAdmin
> but it is greyed out in the Plugins menu.
>
> I found this site with the shape files:
>
> http://efele.net/maps/tz/world/
>
> It has two shape files:
>
> "The tz_world shapefile captures the boundaries of the TZ timezones
> across the world, as of TZ 2011b. The geometries are all POLYGONs, and
> a TZ timezone will sometimes have multiple polygons. There are about
> 28,000 rows.
>
> The tz_world_mp shapefile captures the same boundaries. The geometries
> are either POLYGONs or MULTIPOLYGONs, and there is a single geometry
> for each TZ timezone. There are 394 rows."
>
> First question is, Which shape file to use.  I don't understand the
> difference between the two and the merits of each.
>
> Secondly, clues on how to import this data correctly.
>
> Any other pointers are welcome!  I'm not sure yet, how to do the SQL
> to make the query.
>
> Thanks!
> Scott

Hi Scott,

Can't tell which file is better. It really depends on what you want to do.

Concerning loading file to postgis, you can use the command line
shp2pgsql program:

shp2pgsql -IiDS -s 4326 -g geom tz_world.shp timezone | psql gis20

(running shp2pgsql without arguments will give you the list of
available switches).

Nicolas



More information about the postgis-users mailing list