Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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