[postgis-users] out of memory when using simplify
Paul Ramsey
pramsey at refractions.net
Wed Oct 13 10:51:04 PDT 2004
You'll have to wait and get out on the bleeding edge as the 1.0 series
gets closer to release. We will expose the GEOS polygonize() and
linemerge() functionality in 1.0, which will let you do what you want
right in SQL. For now you could cobble together something w/ JTS or GEOS
directly.
Really though, doing ArcInfo dissolve on simple features is horrendously
wasteful of CPU cycles. What we really need is a coverage model and
coverage operators...
P.
John Cole wrote:
> Ok, I see that collect will get me part of the ArcInfo dissolve
> functionality (grouping lines by a field together), but I'm wondering how to
> get the rest. Namely, reducing the complexity of these grouped lines.
>
> Is there a way to take all of the connected multilines and return a single
> line that could be sent to the simplify function?
>
> Thanks,
>
> John
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net]On Behalf Of
> strk at refractions.net
> Sent: Tuesday, October 05, 2004 12:44 AM
> To: 'PostGIS Users Discussion'
> Subject: Re: [postgis-users] out of memory when using simplify
>
>
> On Mon, Oct 04, 2004 at 02:49:01PM -0500, John Cole wrote:
>
>>Thanks for the reply. I've simplified my layer to 500m first and then did
>>the geomunion and collect to compare them. Both result in the same number
>>of rows, but have different numbers of geometries (with the GeomUnion
>
> being
>
>>slightly simpler). The Collect takes ~3 seconds while the GeomUnion takes
>>over 5 hours.
>>
>>In either case, you cannot run a simplify on the resulting table without
>>getting the out of memory error. I'd like to reduce the number points in
>>each record to speed up drawing. Is there a way to take a multilinestring
>>and turn it into a single linestring? I'm hoping that the simplify will
>>work on a single linestring object instead of the large mulitlinestrings I
>>have now.
>
>
> Use GeometryN(geometry, N) to extract Nth geometry from a multi.
>
> GeomUnion does actually modify the input geometries, merging them
> on a spatial relation basis.
> Collect just take them all.
> Obviously the results are different!
> Anyway. What you did is already reducing the number of points in
> each record (simplify(the_geom)). The OutOfMemory condition happens
> because you're trying to simplify a single huge geometry record
> instead of each of them (run simplify on the resulting table).
> Both Collect and GeomUnion are aggregates, they return a single
> value.
> (I hope did help)
> --strk;
>
>
>
>>Thanks,
>>
>>John Cole
>>
>>-----Original Message-----
>>From: postgis-users-bounces at postgis.refractions.net
>>[mailto:postgis-users-bounces at postgis.refractions.net]On Behalf Of
>>strk at refractions.net
>>Sent: Wednesday, September 29, 2004 10:24 AM
>>To: PostGIS Users Discussion
>>Subject: Re: [postgis-users] out of memory when using simplify
>>
>>
>>On Wed, Sep 29, 2004 at 10:15:26AM -0500, John Cole wrote:
>>
>>>Hello,
>>> I'm trying to do some processing on a roads layer and simplify it for
>>>rendering speed. In ArcInfo, I would use a dissolve on the hwy_num
>
> field
>
>>>and then simplify it to 500 meters.
>>>
>>> From the documentation, PostGIS seems like it can do the same thing,
>>
>>first
>>
>>>selecting into a new table using either the GeomUnion or Collect
>>
>>aggregates
>>
>>>and then again using simplify, however using simplify returns the
>>
>>following
>>
>>>error:
>>>
>>>ERROR: out of memory
>>>DETAIL: Failed on request of size 4172712.
>>
>>I suggest you first simplify and then collect.
>>
>>
>>>
>>>here is my query:
>>> select hwy_num, simplify(the_geom, 500) as the_geom from ra1bb
>>>
>>>where ra1bb is created from:
>>> select hwy_num, geomunion(the_geom) as the_geom into ra1bb from ra1
>>>group by hwy_num
>>>
>>>Another question: what is the difference between collect and geomunion
>>>(besides speed)? Which one would better approximate an ArcInfo dissolve
>>>function?
>>
>>geomunion implements a spatial union: two overlapping areas become
>>a single area.
>>collect just keeps the whole pointset making a GEOMETRYCOLLECTION
>>(or a simpler type if applicable).
>>
>>--strk;
>>
>>
>>
>>
>>>
>>>Thanks,
>>>
>>>John Cole
>>>
>>
>>_______________________________________________
>>postgis-users mailing list
>>postgis-users at postgis.refractions.net
>>http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>-------------------------------------
>>This email and any files transmitted with it are confidential and intended
>
> solely for the use of the individual or entity to whom they are addressed.
> If you have received this email in error please notify the system manager.
> This message contains confidential information and is intended only for the
> individual named. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail.
>
>>_______________________________________________
>>postgis-users mailing list
>>postgis-users at postgis.refractions.net
>>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> -------------------------------------
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list