I want to calculate an intersection between two geometries with the intersection function from JTS Geometry. What happens, if the geometries have different SRIDs?

SimpleFeature sf1=...;      //SRID 31467
SimpleFeature sf2=...;      //SRID 4327

Geometry geom1 = (Geometry) sf1.getDefaultGeometry();
Geometry geom2 = (Geometry) sf2.getDefaultGeometry();

Geometry overlay = geom1.intersection(geom2);

Does the function calculate the intersection in respect to the different SRIDs or does it ignore it? Which SRID does the calculated geometry have?

I didn't find any documentation about that.


As far as I know JTS does nothing with the SRID value (see this email). You will need to use GeoTools to reproject your features to a common projection and then call intersection on them. The result will then be in the common projection and you can then project back to one or both of the input projections.


The previous answer is correct. JTS ignores the SRID value during computation. It is provided purely as metadata for client systems to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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