[geos-devel] Editing geometry

Martin Davis mbdavis at refractions.net
Wed Jan 30 11:38:51 EST 2008



Blas Jimenez, Arturo wrote:
>   
>> How are you planning to "add a point" to your (presumably) 100Mb long 
>> array of points in memory?
>>     
>
> To add a point to an array of points it's not trivial, but an efficient
> way to do it it's to maintain a list of pointers to points and add it at
> the end or change intermediate pointers to insert at the middle of the
> list.
>
>   
I'm not sure I follow your logic, but the key point is that if you think 
you have a structure that allows adding points efficiently and (more 
importantly) allows accessing the points in an array fashion 
efficiently, then just wrap it in a CoordinateSequence and use that to 
build your geometries.  (A CoordinateSequence is just an interface - you 
can have whatever implementation you want underneath it)
>   
>> However you do this, you can them simply build a new Geometry sitting
>>     
> on 
>   
>> top of the modified array inside a CoordinateSequence.
>>     
>
> I cannot do that because I would have been spending high amounts of
> memory and time to get 'almost' the same that I had at the beginning.
> It's unneficient to copy all the list to add a single point.
>
>
>   
>> The Javadoc of GeometryEditor in JTS explains how to use it. Not sure
>>     
> if 
>   
>> this is provided in GEOS - if not, download JTS 1.9 ( 
>> http://sourceforge.net/projects/jts-topo-suite/) and have a look.
>>     
>
> I have already take a look, but the documentation is very similar that
> GEOS'.
>
> How can be used GEOS geometry editors/filters? Is also with this method
> necessary to copy the whole geometry to a new one)
>   
Filters don't require you to copy - but they also won't let you change 
the length of the underlying array.
> Best regards.
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
>
>   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022



More information about the geos-devel mailing list