In my Android project im using mapquest data with OSMdroid. I would like to know what map scales the zoomlevels provide (e.g. 1:10000 etc.). I just found zoomlevel to scale depending on DPI (Is the map's scale also depending on the width and height of the map view, that I am showing?). If I use the mapquest map site, I just see a mapscale in the bottom left corner, but not in a ratio like 1:10000, which I actually need.
What are the scales 1:x at zoomlevel 16,15,14 ?
There are a few things going on here. Let me step through it as I understand it.
First, I believe what you are seeing in the Mapquest link is the ratio. So for zoomlevel 16,15,14:
14 = 1:27083
15 = 1:13541
16 = 1:6770
Although the link doesn't specify it, that should be in meters. So in zoom level 14, every pixel represents 27083 meters.
Additionally, the Bing maps ratios are found here. They are pretty close to the numbers that Mapquest reports, but they are not the same.
So, why are the numbers different? Because the meters-per-pixel ratio changes depending on what latitude you are at. Because of the distortion the Mercator projection produces, the meters-per-pixel is not constant as you change latitude. The Bing maps values are the values at the equator. I don't know where the Mapquest values come from.
Finally - to calculate meters-per-pixel in osmdroid you can call:
TileSystem.GroundResolution(latitude, zoomLevel);
And that will give you meters-per-pixel for a specific latitude. I recommend you take a look at osmdroid's ScaleBarOverlay for an example of how to apply this information.
Stay at the 0° latitude or the equatorial line (earth radius of 6372.7982km for the earth model of the map and equatorial circunference approximate as 40041.472km):
zoom level 0 represents 360° in a window (of 256px) which is on the equatorial line 40'041km
zoom 1 only 180° in the same window which is 20020km
zoom 2 is 90°, or 10010km
and so on always halving.
The scale (always speaking at the equatorial line) depends on the size of your window, if it is 1km wide, it is:
zoom 0 is 1:40041
zoom 1 is 1:20020
zoom x is 1:40041/2^x
etc
If the window is 1 inch wide:
zoom 0 is 1in:40041km or 1:1'576'417'322
zoom 10 is 1in:40041/1024km or 1:1'539'470
zoom 16 is 1:24054
If the window is 200px wide (for a 180 DPI screen):
zoom 0 is 200px:40041km or 1:1'418'775'590
zoom 18 is 200px:40041km/2^18 or 1:5412
This is just on the equatoriali line (0° latitude). In the north or south there is a correction factor to be applied, which is cos(latitude degrees).
Related
When setting a custom image for the map markers (Annotations) on a Skobbler map, one can set the offset of the image using SKAnnotation.seOffset(SKScreenPoint), so that the marker can line up proprly with the exact location of gps coordinates, but the documentation is not clear on what the unit of measurement is for SKScreenPoint or how the offset is calculated.
Is the offset in dip, px, or something else.
Is there a built in way to handle different screen densities using, or do I need to calculate the value based on screen density?
Offset in px.
For example, to set anchor point from center to bottom of annotation offset should be half of height:
annotation.setOffset(new SKScreenPoint(0 /*x*/, annotation_height/2 /*y*/));
i have 5 markers to display on the map, out of which 4 are very near to each other and the fifth one is a little bit distant to these 4. now when i display the map i want all these 5 markers to be shown on map and the with the highest possible zoom. i dont care whether they are on the border of the screen or in the center of the screen.i mean the markers can be scattered on the screen but all i want is that all markers should visible to the user and with the highest possible zoom.
i have tried this Android map v2 zoom to show all the markers . but the result is that it is showing all markers at the center of the map with very little zoom. actually i have calculated screen dimensions using this code.
DisplayMetrics metrics=new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
float height=metrics.heightPixels/metrics.xdpi;
float width=metrics.widthPixels/metrics.ydpi;
but i dont know why there is very little zoom. But wen i saw android documentation, i think the function is doing justice by doing whatever it said it will do.
public static CameraUpdate newLatLngBounds (LatLngBounds bounds, int width, int height, int padding)
Returns a CameraUpdate that transforms the camera such that the specified
latitude/longitude bounds are centered on screen within a bounding box of specified
dimensions at the greatest possible zoom level. You can specify additional padding,
to further restrict the size of the bounding box. The returned CameraUpdate has a
bearing of 0 and a tilt of 0.
Unlike newLatLngBounds(LatLngBounds, int), you can use the CameraUpdate returned by
this method to change the camera prior to the map's the layout phase, because the
arguments specify the desired size of the bounding box.
as it says it keeps all the markers at the center of the map. i do not want that. i want all the markers visible to the user with the maximum possible zoom and markers scattered. can anybody please help me?
Your calculation of float width and height is incorrect.
What your width holds now is inches (value of approx. 2 on phones). You need not to divide pixels width.
How is area calculated using Google Static map API?
After passing the Latitude and Longitude of a plot to the google Static map API, what we get is the final result.
How is this obtained?
How is it calculated, is there any formulae which is applied?
I'm not sure if there is a way to directly compute the are, ut firs step is to compute meters per pixels . You can accomplish that if you know map dimensions in pixels and level of zoom , i'm not sure if my calculations are right , but at 45 degrees latitude(north) the scale 0.88 meters per pixel at zoom level 20 , and then this unit doubles with level of zoom ...(ex. at level 19 scale is 0.88*2 , at 18 ..0.88*4 ..etc)
I have a MapView centered at point P. The user can't change the MapView center, but he can choose a radius of a circle to be display around point P, and change it dynamically with the map being redrawn at each change to show the new circle.
The thing is, i want the map to zoom in or out as necessary, in order to display the entire circle at the viewable area. I've tried this:
Projection proj = m_Map.getProjection();
Point mapCenterPixles = new Point();
proj.toMapPixels(center, mapCenterPixles);
float radiusPixels = proj.metersToEquatorPixels(newRadius);
IGeoPoint topLeft = proj.fromPixels(mapCenterPixles.x - radiusPixels,
mapCenterPixles.y - radiusPixels);
IGeoPoint bottomRight = proj.fromPixels(mapCenterPixles.x
+ radiusPixels, mapCenterPixles.y + radiusPixels);
m_Map.getController().zoomToSpan(
topLeft.getLatitudeE6() - bottomRight.getLatitudeE6(),
topLeft.getLongitudeE6() - bottomRight.getLongitudeE6());
But it seems i'm missing something, as the values passed to zoomToSpan() cause no chnage, I'm kind of lost here, can someone please shed some light on how to zoom the map to span a bounding box of the circle given its radius in meters, and its center points?
Google Maps zoom levels are defined in powers of two, so MapController#zoomToSpan() also zooms by powers of two.
Ergo, if the span you compute above is already displayable within the current zoom level, it's likely nothing would actually change visually in the map until you need to go to the next larger or smaller zoom level.
This behavior is somewhat vaguely described in the documentation for MapController#zoomToSpan
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..
At a high level:
Get the bounding coordinates of your current map view.
Use your coordinates to compute the distance either horizontally or vertically across your map. Convert your distance to meters, if necessary.
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.
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.
Draw your circle using the radius you got in step 4.