[geos-devel] Editing geometry

Blas Jimenez, Arturo ablas at indra.es
Thu Jan 31 03:15:28 EST 2008


Ok, lots of thanks Martin. 

I'll maybe implement a kind of wrapper to give my geometries the
posibility to make a commit of changes, so that I don't have to change
my whole data to add or modify a single point. 

I store a list of command objects with local changes and in my commit
all changes are applied to a CoordinateSequence that is assigned again
to the geometry.

Best regards.

>   
>> 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

_______________________________________________
geos-devel mailing list
geos-devel at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/geos-devel


More information about the geos-devel mailing list