Yes, you need to rebuild the geometry using a 3D PackedCoordinateSequence.

The easiest way to do this is to make a new GeometryFactory based on a 3D PCS, and then use the GeometryFactory.createGeometry method on the original geometry. This will return a new geometry using the new PCS. You can then update the Z ordinate as required.

Fernando González wrote:
Hi all,

I'm trying to add a z coordinate to a 2D geometry and I'm using a CoordinateSequenceFilter without a total success. It doesn't work when the geometry has been built using a PackedCoordinateSequence and I get an ArrayIndexOutOfBoundsException when I set the z ordinate. I understand that PackedCS for 2d geometries doesn't have enough space to store 3d geometries.

This issue is related with another one I had some time ago[1]. The solution has worked fine until I've tried to add 3d ordinates to a 2D PackedCoordinateSequence.

Is there a general method to transform a 2d geometry into a 3d geometry? Mayeb is it possible to change the coordinate sequences a geometry uses? Maybe kind of clonning?

I'm thinking of analyzing recursively the Geometry and producing another one with the 3d coordinates. Has anyone done this before?

Thanks in advance.


[1]http://lists.refractions.net/pipermail/jts-devel/2008-June/002539.html
------------------------------------------------------------------------

_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

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

_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to