[GRASS-user] Removing detail from polygons
Brent Wood
b.wood at niwa.co.nz
Wed Jul 26 17:34:16 EDT 2006
Jose Gomez-Dans wrote:
> Hi!
> I have a large shapefile with polygons. It takes a long time to load
> it into GRASS with ogr, but my question is other. I only need to use
> this polygon for drawing "informal" maps (i.e., they don't need to be
> accurate). The detail of these polygons is huge, so that if I use plot
> them with GMT or any other tool, I get massive EPS files. I don't need
> most of those vetices. Ideally, I'd like to specify some distance so
> that I get a single line, rather than a myriad lines. I thought
> v.clean could do this, but I am unsure whether it is the right tool or
> not.
>
I've used PostGIS for manah\ging spatial data. It is possibly overkill
for what you are asking, but using the shp2pgsql program that come with
it, you can easily load a shapefile into PostGIS. You can then easily
simplify the geometry & use pgsql2shp to export the new version. I have
used it for making scale dependent layers of the same data for plotting
purposes, nmuch like you seem to be requiring.
The PosGIS simplify() function is an implementation of the
Peuker-Douglas algorithm which is commonly used for this purpose. IT is
quite handy, in that despite the function operating in projection units,
you can wrap it in transform(), so you can take a lat/long geometry,
transform to an appropriate meter based equidistant projection, simplify
& project back again in a single SQL statement.
ie: transform(simplify(transform(geometry)))
Cheers,
Brent Wood
More information about the grass-user
mailing list