[geos-devel] Editing geometry

Martin Davis mbdavis at refractions.net
Tue Jan 29 11:57:02 EST 2008

How are you planning to "add a point" to your (presumably) 100Mb long 
array of points in memory?

However you do this, you can them simply build a new Geometry sitting on 
top of the modified array inside a CoordinateSequence.

The reason GEOS/JTS don't provide update capability is that there are 
many ways to implement this depending on how your underlying data is 
structured. The design decision was made that it's better not to make 
assumptions about how best to do this.

Also, this means that "aliasing" errors are not the fault of the API!

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.

Blas Jimenez, Arturo wrote:
> Hello,
> I am currently learning GEOS c++ API and I’m trying to edit a simple 
> geometry (trying to add a point to a line string). I’ve realized that 
> geometries are not editable, so I must, to move, remove or add a 
> single point to create a fully new geometry with a new coordinate 
> sequence that only differs on a single point.
> Is there any way to edit a geometry without creating a full copy of it 
> (in my case due to the complexity of my geometries is not possible – I 
> have geometries that can reach 100Mb stored in memory-).
> Another doubt is how to edit geometries using GeometryEditor class. 
> Should I implement my own class deriving of it? How must it be used?
> Thanks in advance.
> ------------------------------------------------------------------------
> _______________________________________________
> 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