On 6/27/2011 1:37 PM, Christian Guirreri wrote:
I'm trying to do something fairly simple. I'd like to take the Tiger
2010 Data - tl_2010_us_cd111 and tl_2010_us_county10 - and create shape
files that are considerably smaller and more simplified. In the past
I've just used MapShaper and been OK with that, but I was having trouble
uploading tl_2010_us_county10 into it and I've decided its time to learn
some GIS basics anyway.

I've definitely successfully setup my environment - PostegreSQL 9 with
PostGIS. I've used the shp2pgsql wizard included with pgadmin to import
the data sets into their own databases, without the "Load Geography
column" checked. I've been able to export this data back to shp
using pgsql2shp and view the resulting shp in QuantumGIS and ACDSee Canvas.

But when it comes to simplification - I'm not sure where to even
start. I'm no database expert beyond some simple mysql so GIS is
especially overwhelming. I only know that I want to
use ST_SimplifyPreserveTopology() as I'm fairly certain a number of
things will disappear if I don't.

Would love if someone could provide me with the SQL to make this happen!

First you should understand that ST_SimplifyPreserveTopology() works on a single geometry at a time and not on multiple geometries in a coverage. The difference is in a coverage the the polygons that share a common edge that is simplified would continue to have a common simplified edge. When polygons are simplified individually with knowledge of the adjacent polygons it is possible for gaps and overlaps to occur along the simplified edge. ST_SimplifyPreserveTopology() is designed to try and minimize these effects but there are no guarantees.

You might try something like:

select addGeometryColum('myschema', 'mytable', 'simple_geom', 4326, 'MULTIPOLYGON', 2); update myschema.mytable set simple_geom = ST_SimplifyPreserveTopology(the_geom, <tolerance>);

where <tolerance> is replaces by an appropriate value. This will depend on the some trial and error. The above assume srid=4326 which is probably not a good projection for doing simplification so you might want to project your data into some other UTM or Mercator projection depending on your coverage area and tolerance needs to be set with respect to those units.

-Steve W
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to