Get $15 off on Apress.com with our Halloween Sale and Coupon TREAT - Shop Now
Simplify: Reduce the weight of a geometry
Simplify reduces the complexity and weight of a geometry using the Douglas-Peucker algorithm.
It in general reduces the number of vertices in a polygon, multipolygon, line, or multi-line geometry.
It takes 2 arguments, the geometry and the tolerance.
we will apply the simplify function on Boston neighborhoods that are in SRID 2249 (NAD83 / Massachusetts Mainland (ftUS)) and compare the sizes of the shape files
if we were to dump these out as ESRI shape files. We will also show pictorially how simplify changes the geometries.
Original: Size of Shp - 95 kb
Simplify 500: Size of Shp - 7 kb
SELECT simplify(the_geom,500) as simpgeom
Simplify 1000: Size of Shp - 5 kb
SELECT simplify(the_geom,1000) as simpgeom
Note: When simplifying longlat data, you often get very strange results with simplify. It is best to first transform data from longlat to some other coordinate system, then simplify and then transform back to longlat. So something like
SELECT transform(simplify(transform(the_geom, 2249), 500),4326) from neighborhoods
Post Comments About PostGIS Simplify