Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Server: Lat/Lon ordering is wrong when doing encoding/decoding #58

Open
mpschaeuble opened this issue Jan 11, 2018 · 1 comment
Open

Comments

@mpschaeuble
Copy link

I wasn't able to serialize a WGS84 point (Geometries.mkPoint(new G2D(longitude, latitude), CoordinateReferenceSystems.WGS84);) such that the SQL server database accepted its byte representation to write the result into a geography typed column.

According to the SQL Server documentation ("Microsoft SQL Server CLR Types Serialization Formats", section "GEOGRAPHY POINT Structure"), latitude must be serialized before longitude. However, the G2D ordering is reversed. As a fix, I changed the ordering in SqlServerGeometry.setCoordinate(...) and SqlServerGeometry.readPoints(...)

Can someone approve that this is a bug?

@maesenka
Copy link
Member

That is not really a bug. The current MSSqlServer Encoders/Decoders are designed to work with Geometries, not Geographies.

Now that geolatte-geom Geometries contain coordinate system information, we are ready to take into account the difference between Geometry and Geography structures.

This is something I'm definitely willing to do, as soon as I find the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants