Question

I tried to add some GeoPoints on my map but I've problems with some “special” points.

The range of the latitude value is +90 to -90 and therefore I want to add a point like the this...

int latitude: 85000000;
int longitude = 45000000;
GeoPoint point = new GeoPoint(latitude, longitude);

...and after this I double check the latitude value with:

point.getLongitudeE6();

I always get a maximum value of 80000000 back. Can someone explain why google set this limit for a GeoPoint and what the reason for this limitation is?

Thanks!

Was it helpful?

Solution

Your issue is with getLatitudeE6(). GeoPoint doesn't work near the poles. You're probably going too far north or too far south.

This behavior is by design. From the docs:

[The latitude] will be clamped to between -80 degrees and +80 degrees inclusive, in order to maintain accuracy in the Mercator projection.

Likewise, longitude is limited to -180 to +180.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top