Not sure this is the correct place to ask. I have no code to show, just wondering if this can be handled with JTS.

Is it possible to handle 3D intersections with JTS? Given that we have two polygons, in this case with XYZ coordinates(coplanar and aligned).

Looking on different ways to split P1 into two polygons, one that is not covered by P2 and the other one that is covered by P2.

enter image description here

1 Answer 1


According to the JTS FAQ, this library does not allow the manipulation of 3D geometry :

4. Does JTS support 3D operations?

JTS does not provide support for true 3D Geometry and operations. However, JTS does allow Coordinates to carry an elevation or Z value. This does not provide true 3D support, but does allow "2.5D" uses which are required in some geospatial applications.

see https://locationtech.github.io/jts/jts-faq.html#B4

Personally, the only times I tried to do this kind of processing I ended up using the CGAL library. It is a library that is quite complicated to access, but it allows you to do all kinds of 3D operations. In your case you should refer to this part of the documentation : 3D Boolean Operations on Nef Polyhedra.

Note that there is an alternative kernel for PostGIS that allows you to do some 3D operations with CGAL (see SFCGAL functions). But only the simplest operations are possible, complex or specific treatments require a direct use of CGAL.

However, if all the geometries you want to process are coplanar and aligned, you can cheat. Reproject all geometries in a two-dimensional reference frame (e.g. X are plane length and Y the plan height) and do your processing in this reference frame.

  • 1
    hi, yeah, found the same info. Just wanted to see if there was something else that could be done with JTS. All geometries are coplanar but not aligned. Think that I can rotate them to align with either X or Y axis, then use JTS for the 2D processing, and when done rotate back to original position. Might work.
    – Dimman
    Apr 25, 2022 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.