Quantcast

Adding a z coordinate

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Adding a z coordinate

Fernando González
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
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Adding a z coordinate

Martin Davis
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
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>  

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

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Adding a z coordinate

Fernando González
It works perfectly. Many thanks Martin.

On Mon, May 4, 2009 at 6:10 PM, Martin Davis <[hidden email]> wrote:
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
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
 

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

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



--
Fernando González Cortés
Ingeniero informático,
http://fergonco.scienceontheweb.net

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