[postgis-users] Newbie postgis application question

Paul Ramsey pramsey at refractions.net
Sat Aug 3 20:55:58 PDT 2002


OK, a real quicky.
First, make sure you've uploaded the spatial_ref_sys.sql file.
Now, do an "update yourtable set thegeom=setsrid(thegeom,4269)"
This tells the system that all your geometries are in NAD83 LL.
Now, read through your /usr/local/share/proj/epsg file (you have
installed proj4 right? if not, do so, then recompile postgis w/ proj4
support).
Find the stateplane projection number for the state you want to map.
Search for the state name in the file, and find the NAD83 stateplane
variant. They are almost always 'lcc' projections. For example, numbers
32148 and 32149 are the stateplane definitions for Washington state.
Stateplane defs are the classic planar projections for US county and
state areas. They tend to result in nice 'normal' looking maps for small
regional areas. Then you can create a new table which has reprojected
geometries in it. Like:

select transform(thegeom,32148),road_name,address_num into planartable
from statetable where county = 'King County' and state = 'Washington'

Enjoy,
P.

Kevin Murphy wrote:
> 
> I have a little mapping project that I'd like some advice on.  Let me tell you
> that I know nothing about GIS and mapping except what I've learned from
> snooping around the net in my spare time in the last few days.  Basically
> what I need to know is how to convert NAD83 longitude/latitude coordinates
> via some sort of projection into coordinates that will look reasonable when
> mapped at the scale of, say several counties, or an entire state.  I can
> program in C and Perl, I have Linux, I have PostgreSQL and PostGIS
> successfully installed.  I have used Postgres before.   I have downloaded the
> census bureau's cartographic boundary files for US counties and written a
> couple Perl programs to manipulate the raw data in text format. I wrote a
> program to create maps in Postscript using the data and realized from the
> distortion that I need to transform the coordinates via a projection.
> 
> Thanks!
> Kevin Murphy
> 
> P.S.  For those with time to kill, read on.
> 
> For each county in the United States, I'd like to generate a map showing the
> outline of this county and its immediate neighbors (defined either by
> adjacency or some sort of radius rule; I haven't decided).
> 
> The map needs to show just the county outlines and have the names of the
> counties in reasonable locations (postGIS's ability to compute the centroid
> would probably help with the latter).
> 
> The map ultimately should be a GIF file with accompanying image map HTML
> fragment so that a user could click on a county and visit a target URL.
> 
> Here's what I've done so far:  (I haven't used PostGIS or Postgres at all yet
> in this project.)
> 
> *) I have downloaded the census bureau's boundary files for US counties.
> *) I wrote a Perl program to identify county adjacencies; based on the polygon
> data, it is able to, e.g. spit out the adjacent neighbors of any specified
> county.
> *) I wrote a Perl program to create a Postscript file containing a map of
> specified counties.  I can easily convert this to GIF later, and it will be
> easy to generate the html area maps.  Unfortunately, I noticed at this point
> that my maps were subtly distorted, which made me realize that I need to
> project from longitude and latitude into x-y coordinates.
> *) I have imported the boundary geometries into PostgreSQL but don't really
> know what to do with them there.
> 
> I noticed the link to Mapserver, which looks promising, but it seems to be
> overkill for what I want to do at the moment.  Of course, if I do any other
> mapping projects (and I'd like to), the time investment might pay off.
> Actually, that's why I'm looking at PostGIS instead of just looking up the
> algorithms and rolling my own solution.
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list