hi everybody,
after finding an apparently neat implementation at
https://mail.uni-bonn.de/Redirect/groups.google.com/group/Google-Maps-API/browse_thread/thread/d2103ac29e95696f?hl=en
i tried to implement it in my project in c++ with Qt. here is my
resulting code:
QPoint GoogleMaps::GoogleProjection(geoPoint point)
{
double sin_phi = sin(point.lat().geoBogen());
double norm_x = point.lon().geoBogen() / PI;
double norm_y = (0.5*log((1+sin_phi) / (1-sin_phi))) / PI;
double x_point = pow(2, zoom) * ((norm_x+1)/2);
double y_point = pow(2, zoom) * ((1-norm_y)/2);
double sin_phi_center = sin(verticalCebter.geoBogen());
double norm_x_center = horizontalCenter.geoBogen() / PI;
double norm_y_center = (0.5*log((1+sin_phi_center) / (1-
sin_phi_center))) / PI;
double x_center = pow(2, zoom) * ((norm_x_center+1)/2);
double y_center = pow(2, zoom) * ((1-norm_y_center)/2);
double offset_px_x = double(round(256 * (x_point - x_center)));
double offset_px_y = double(round(256 * (y_point - y_center)));
double centermappxx = mapxext/2;
double centermappxy = mapyext/2;
int px_x = centermappxx + offset_px_x;
int px_y = centermappxy + offset_px_y;
QPoint projectedPoint(px_x,px_y);
return projectedpoint;
}
the resulting x and y coordinates are totally messed up. anyone any
idea what i missed?
thanks a lot in advance,
daniel
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.