How to draw a circle of radius in meters using canvas.drawCircle() that needs radius in float in android

StackOverflow https://stackoverflow.com/questions/22133292

Question

I have this requirement of drawing two concentric cricles on canvas. The inner one with radius of 300 meters and outer one with radius of 500 meters. Till now i have been able to find the center of the screen with respect to coordinates in lat long. What i am trying to figure out is, how to map the meters to float while using canvas.drawCircle

This is my code for the time being I have two circles with random radii in float 120 and 160.

        int x = ((MapView)mParent).getWidth()/2;
        int y = ((MapView)mParent).getHeight()/2;

        dPointLatLon dLatLon = MapToWorld(x,y );
        System.out.println("LAT " +dLatLon.lat);
        System.out.println("LON " +dLatLon.lon);


        canvas.drawCircle( x, y,120f , mSelectionBrush);
        canvas.drawCircle( x, y,160f , mSelectionBrush);

This is my out put. Can you please guide me to how to use the distance in meters and convert them to fit into canvas.drawCircle.

enter image description here

No correct solution

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