[postgis-users] issue with pgsql2shp

strk at refractions.net strk at refractions.net
Mon Jun 5 06:56:04 PDT 2006

On Fri, Jun 02, 2006 at 09:05:46AM -0500, John Cole wrote:
> I'm trying to create shapefiles from tiger data inside our postgis database
> with pgsql2shp.  Since these shapefiles are for rendering with mapserver
> only, I'd like to pre-process these so they are optimal for rendering at
> certain scales and maximize mapserver performance.  I'm using "1.0
> Here are some issues I've run into:
> 1)  If I give pgsql2shp a query like "select the_geom from tgr_roads where
> cfcc like 'A1%' or cfcc like 'A2%'", I get the following error; ERROR:
> Cannot determine geometry type (empty table).  I found a mail list message
> from 2003 about adding a -t switch to specify the geometry type, but that
> doesn't appear in this version.  I'd like to do this without creating
> temporary tables.

You can use a query instead of a tablename.

> 2)  I'd like to make reduced resolution shapefiles for certain scales (for
> example, at 1M scale, no feature should be shorter than 250 meters, the size
> of one pixel on the map).  Does the simplify() function do this?  I have the
> following query, which I think does this, but I get the same error as in 1)
> above.

I suggest SnapToGrid() for pixel-based precision reduction.
Use a grid's cell size equal to your pixel size.

> select transform(simplify(transform(collect(the_geom),32616),250), 4326) as
> the_geom from tgr_roads where cfcc like 'A1%' or cfcc like 'A2%' group by
> hwy_num, rd_name
> 3)  I don't see the equivalent densify() ArcInfo function in PostGIS, is
> there one?  When creating reduced resolution shapes, I like to densify they
> line to 1-10 meters and then reduce the resolution to 250 meters to ensure
> that the original shape of the file is retained.

Could this be segmentize() ?


More information about the postgis-users mailing list