sam_k
sam_k

Reputation: 6023

i want to draw circle around my current location excatly 1 kilometers readius

hi friends i want to draw circle around my current location exactly 1 kilometer radius so wat can i do.....i able to draw circle but how to put radius so it becomes exactly one kilometer..

Upvotes: 1

Views: 1299

Answers (1)

aroth
aroth

Reputation: 54806

At a high level:

  1. Get the bounding coordinates of your current map view.
  2. Use your coordinates to compute the distance either horizontally or vertically across your map. Convert your distance to meters, if necessary.
  3. Divide your distance in meters by the horizontal or vertical resolution (in pixels) of your map view. This gives you the number of meters per pixel at your current zoom level.
  4. Evaluate 1000 / <meters per pixel> to determine the number of pixels in 1 kilometer at the current zoom level. This is the radius of your circle.
  5. Draw your circle using the radius you got in step 4.

Upvotes: 2

Related Questions