[GIS] Intersection with JTS Geometry

geometryintersectionjts-topology-suite

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.

Best Answer

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.