[geos-devel] Modify a linestring or prevent coordinatesequence ownership transfer

Martin Davis mtnclimb at gmail.com
Thu May 24 07:43:59 PDT 2018


Actually in JTS this is possible, by creating a CoordinateSequence
implementation which allows extending the list of coordinates (e.g.
something like this [1]).

I guess the difference is that in C/C++ the API has to explicitly control
the lifetime of the geometry associated structures.  Whereas in Java object
lifetimes are managed by the GC, and objects can live as long as they are
being referenced.

Not sure what the best way to ease this constraint is - but it seems like
there should be a common pattern to make this work?

[1] https://github.com/locationtech/jts/pull/271

On Thu, May 24, 2018 at 5:58 AM, Sandro Santilli <strk at kbt.io> wrote:

> On Thu, May 24, 2018 at 09:36:57AM +0200, Tanguy Fardet wrote:
> > Dear GEOS developers,
> >
> > I would like to know if there is a way, within the GEOS library, to
> either
> > 1) modify an existing LineString without copying the existing points
> inside
> > or 2) create a LineString from a CoordinateSequence without having to
> clone
> > the latter and without it being destroyed with the LineString (i.e. how
> to
> > not transfer ownership).
> >
> > From a quick look at the code, this does not seem possible, but I would
> like
> > to make sure it is indeed the case.
>
> I confirm this is the case, by (JTS-following) design.
>
> --strk;
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geos-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20180524/47ecd268/attachment.html>


More information about the geos-devel mailing list