Creating a circle with a fixed radius in kilometers

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Creating a circle with a fixed radius in kilometers

Postby TheGuest » Sun Oct 18, 2009 10:14 pm

Hi people,

I am creating an application where I need to show to the user a proximity radius. I know I can draw a circle with canvas.drawCircle(), but the input it requires is in pixels.
So my questions are as followed, how do I calculate the radius of a circle which needs to be for example 5 kilometers into pixels?
And how do I keep it in the correct perspective when zooming?
TheGuest
Freshman
Freshman
 
Posts: 2
Joined: Sun Oct 18, 2009 10:02 pm

Top

Postby TheGuest » Mon Oct 19, 2009 11:01 pm

Man how could I have been so blind, after digging around I found the following method:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. float radius = projection.metersToEquatorPixels(2400);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


This should give me a radius in pixels of 2.4 kilometers. Unfortunately it's not 2.4 kilometers, more like 1.5... Strange, but it will have to do I guess...
TheGuest
Freshman
Freshman
 
Posts: 2
Joined: Sun Oct 18, 2009 10:02 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 6 guests