[postgis-users] Newbie postgis application question

Paul Ramsey pramsey at refractions.net
Sat Aug 3 21:34:58 PDT 2002


Kevin Murphy wrote:
> 
> Wow, Paul, thanks a lot.  I had just found the transform() function but it
> would have taken me a while to put all the pieces together.
> 
> One question: what if I want to create a map that crosses state boundaries?
> Will there be odd discontinuities?

Pick the projection which holds the majority of the area. Using local
projections for areas which spooge outside of the normal area of
interest generally results in a little bit of distortion, so try things
out and see what works. Often the distortion will not be particularly
noticable, if at all. As an alternative, a common 'larger region' planar
projection is UTM (Universal Transverse Mercator). UTM has boundaries
too, but the areas are larger, and again taking the zone which holds the
majority can result in a nice projection nonetheless. 26910 is a UTM
example, zone 10, which holds most of the west coast of north america.

Your final possibility if you are really into having a perfect planar
projection for your maps every time is to roll your own. You can create
a new projection and insert it into spatial_ref_sys, then procede as
normal. An easy roll-your-own projection is the polyconic, because it
only has a few parameters. Basically an origin (which you would want to
put smack in the middle of your area of interest) and some offsets
(which you could just leave at zero, since you are using the projection
for display and not for a data archive or anything). In proj4 terms,
"+proj=poly +lat_0=<yourlat> +lon_0=<yourlat>" would do the trick, where
yourlay and yourlon are the centers of your area of interest. If you
can, though, using "standard" projections like stateplane and UTM helps,
particularly for maps you are going to publish, because then you can put
the info into the map metadata ("Washington Stateplane Projection,
1:25000 Scale") like a good cartographer and people will have a
reference point to work back from archivally if they use the map in the
future after you have been hit by a bus (did I mention you were going to
be hit by a bus?).

Happy projecting,
Paul

> On Saturday 03 August 2002 11:55 pm, Paul Ramsey wrote:
> > 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.
> > >
> 
> _______________________________________________
> 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