Issue
My known data are my current location (GeoPoint) and radius in meters. I want to draw circle around my current location based on map projection and radius. My map view overlay does override draw method like
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
Projection projection = mapView.getProjection();
GeoPoint myLocationGeoPoint = getLocationGeoPointFromSomeSource();
Point myPoint = new Point();
projection.toPixels(myLocationGeoPoint, myPoint);
int radiusPixel = (int) projection.metersToEquatorPixels(getRadiusInMetersFromSomeSource());
canvas.drawCircle(myPoint.x, myPoint.y, radiusPixel, mPaintStroke);
canvas.drawCircle(myPoint.x, myPoint.y, radiusPixel, mPaintFill);
super.draw(canvas, mapView, shadow);
}
Problem of this code is that radiusPixel
is far too small. I assume that the problem is in metersToEquatorPixels
method which takes parameter in meters and calculates approx. pixels if that meters are on equator. Am I right?
But I want to calculate how many pixels does my radius takes not only if I stand on equator. Is there any build-in function for that kind of job or do I have to do it by hand?
Regards
Solution
So this has an answer
I think it's covered by this question
How to compute a radius around a point in an Android MapView?
Answered By - user70568
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.