[postgis-users] Re: "Summarizing" a collection of geometries

Dylan Beaudette dylan.beaudette at gmail.com
Tue Apr 22 11:47:47 PDT 2008


On Tuesday 22 April 2008, Reid Priedhorsky wrote:
> Reid Priedhorsky wrote:
> > Dear list,
> >
> > I would like to compute a "summary" of a collection of geometries
> > (points, linestrings, polygons, or any combination).
> >
> > Here is the use case. I would like to summarize the geometry collection
> > and present this summary visually so users working at a small scale can
> > see, "ah, if I zoom in here, I can see more details about this geometry
> > collection".
> >
> > The simple solution would be to compute a convex hull or bounding box,
> > but this fails if the members of the collection are far apart (users
> > could zoom into the middle and see nothing). In this case the summary
> > would need to be a multipolygon. But the trick is figuring out when to
> > split summary polygons into multipolygons.
> >
> > Has this been done? Do any of you have suggestions or references?
> >
> > It is very preferable to do this entirely in the database rather than in
> > external code. Embedded procedures are fine.
> >
> > As you can see I am not entirely sure of my terminology, so any
> > suggestions there would be welcome as well.
>
> Just to clarify, this is something I need to do now -- I don't want to
> wait until a really slick way is implemented.
>
> Here's one idea:
>
> 1. Use ST_Buffer() to compute polygon buffers around members of the
> collection. Question: ST_Buffer() docs say it can't handle
> GeometryCollections. What about e.g. MultiPoint or MultiPolygon?
>
> 2. Take the ST_Union() of the result of #1, producing a MultiPolygon.
>
> Does seem like a reasonable approach?
>
> Thanks,
>
> Reid

Almost forgot:

another simple approach:

export your points as ASCII, something like:

x|y|z|value


import into GRASS with r.in.xyz:
http://grass.osgeo.org/grass63/manuals/html63_user/r.in.xyz.html

adjusting the region resolution will give you control over the final grid size 
upon which the summary stats are computed. I suppost the snaptogrid() in 
postgis might also do the trick.

cheers,

Dylan






-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341



More information about the postgis-users mailing list