Google Maps API V2. 1 met?



  • Hi. I'm doing my TileProvider, and I need to paint on the stash of some radius set in metres. Question: How is it right to transfer a radius in meters to a zoom'a?



  • From the meters to the pickles:

    private static final float EARTH_RADIUS = 6371000; 
    private static final int TILE_DIM = 512;
    

    private int meters2pixels(float meters, double lat, int zoomLevel)
    {
    long map_width = TILE_DIM * (int)Math.pow(2, zoomLevel);
    double metersPerPixel = 2 * Math.PI * EARTH_RADIUS * Math.cos(Math.toRadians(lat)) / (double)map_width;
    return (int)(meters / metersPerPixel);
    }


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2