[postgis-users] A way to split polygons?

Paragon Corporation lr at pcorp.us
Thu Mar 3 21:46:26 PST 2011


> Mike Toews has suggested ST_Simplify or ST_SimplifyPreserveTopology, but
I'm unsure of what value to use for the tolerance.  The CRS is geographic,
not projected.

Simplifying in geographic never works well.  What we usually do is pick a
projected unit simplify in that and then convert back to 4326.  You might
also want to try snapping the points to get rid excess floating points.
Seems to work well for us.

You could even use web mercator 3785 for projection.  It will still be much
better than working with geographic for simplification though working with
one for your region is best.


5), 1000),4326), 0.000001)

If you are using the ST_AsKML function, you can skip the ST_Transform and
ST_SnapToGrid since ST_AsKML will automatically transform back to 4326 if
the data is not already and you can use the precision argument.

So something like

-- this will simplify every 1000 meters (the simplification will be more or
less  in some geographic locations than others since its not space
preserving) up to precision of 5
--  even reducing the precision alone can often reduce a lot of bandwidth
for large geometries

SELECT ST_AsKML(ST_SimplifyPreserveTopology(ST_Transform(geom,3785),1000),5)
As akml

Here is a trivial example:

G(-89.928323 46.554292,-89.916104 46.554677,-89.911933 46.543432,-89.904791
46.524263)',4326), 3785),1000), 4) a kml

<LineString><coordinates>-89.9283,46.5543 -89.9161,46.5547


More information about the postgis-users mailing list