I use the following code :
#define kDefaultTileSize 256
static double initialResolution = 2 * M_PI * 6378137 / kDefaultTileSize;
static double originShift = M_PI * 6378137;
-(RMLatLong)centerLatLonForTileX:(unsigned int) tx tileY:(unsigned int) ty zoom:(unsigned int) zoom {
RMLatLong center;
double px = (tx+0.5)*kDefaultTileSize;
double py = (ty+0.5)*kDefaultTileSize;
double res = initialResolution / exp2(zoom);
double x = px * res - originShift;
double y = py * res - originShift;
center.longitude = (x / originShift) * 180.0;
center.latitude = 180 / M_PI * (2 * atan( exp( (y / originShift) * M_PI)) - M_PI_2);
return center;
}
--
You received this message because you are subscribed to the Google Groups "route-me" group.
To view this discussion on the web visit https://groups.google.com/d/msg/route-me-map/-/FEN90SAlFfAJ.
To post to this group, send email to route-...@googlegroups.com.
To unsubscribe from this group, send email to route-me-map...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/route-me-map?hl=en.