s2-geometry-library-csharp
s2-geometry-library-csharp copied to clipboard
Wrong coordinates returned from S2CellId#ToLatLng?
I need to extract Lat/Lng coordinates from a given CellId, but I'm having a slight difference netween the returned values and the correct ones, and I can't understand why.
The original coordinates are
47.678956162876,-122.12871664749933
while the CellId
is
6093384589483442176
What I get back is
47.72217122031298,-122.12705319813203
Here's a little snippet of my code:
var cellId = new S2CellId(CellId).ToLatLng();
return new Geopoint(new BasicGeoposition() {Latitude = cellId.LatDegrees, Longitude = cellId.LngDegrees})
Am I doing something wrong or is there an issue when converting back to Lat/Lng?
I'm facing the same problem. C2 cells end up overlapping or having gaps.
I can reproduce the issue but so far had no luck fixing it. I thought that this is my logic mocking with coordinates and changes precision.