GeoLatte / geolatte-geom

A geometry model that conforms to the OGC Simple Features for SQL specification.
Other
134 stars 63 forks source link

Converting to JTS geometry uses a default GeometryFactory which causes problems #49

Closed michikommader closed 7 years ago

michikommader commented 7 years ago

When converting a GeoLatte geometry into a JTS geometry via org.​geolatte.​geom.​jts.JTS.to(), a default GeometryFactory is used which causes problems when dealing with JTS functions later.

One example: Even though JTS.to() copies the SRID of the original GeoLatte geometry, the internally used GeometryFactory defaults to a SRID of 0. So the converted JTS geometry is labelled with a correct SRID whereas its underlying GeometryFactory has a wrong SRID. This is inconsistent and misleading because subsequently applied JTS functions like reverse() refer to the geometry's GeometryFactory which, with it's invalid SRID, returns a resulting geometry with invalid SRID as well.

My suggestion: In org.​geolatte.​geom.​jts.JTS we should not use a default internal GeometryFactory but at least allow to specify a custom one explicitly.

maesenka commented 7 years ago

I think the commit referenced above should resolve this issue. What do you think?

michikommader commented 7 years ago

This is an elegant solution and works as expected. Thanks a lot!