Area calculation in Google Static Map API - android

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)

Related

Android Google Map: Calculate radius to be drawn depend on meters and zoom level of map

I would like to known if there is a way to calculate radius to be drawn on Google Map.
Now I have a GoogleMap with ViewOverlay over it for inverting the selection. So I want to know what is actual radius (which to be drawn) equal to.
radiusToByDrawnOnViewOverlay = radiusFromSeekBar * currentGoogleMapZoom
I found my answer here: https://gist.github.com/amay077/6879638. Actually this is method which was deprecated in GoogleMap.

What is difference between ZoomTo and ZoomBy in google map

Currently, I am working with google map and may have confusion between this two methods. I don't differentiate working of this two method so, can anyone explain me what is difference between zoomBy() and zoomTo()
Code:
mMap.animateCamera(CameraUpdateFactory.zoomBy(zoomLevel));
mMap.animateCamera(CameraUpdateFactory.zoomTo(zoomLevel));
CameraUpdateFactory.zoomTo(float) gives you a CameraUpdate that
changes the zoom level to the given value, while keeping all other
properties the same.
CameraUpdateFactory.zoomBy(float) and
CameraUpdateFactory.zoomBy(float, Point) give you a CameraUpdate that
increases (or decreases, if the value is negative) the zoom level by
the given value. The latter fixes the given point on the screen such
that it remains at the same location (latitude/longitude) and so it
may change the location of the camera in order to achieve this.
From official documentation here
So in short zoomTo just changes the zoom level to the given value, while the zoomBy increases or decreases ( e.g. with zoomTo(20) your camera will have the zoom level set to 20, but if your zoom level was 20 and you call zoomBy(-5), your zoom level will become 15)
public static CameraUpdate zoomBy (float amount, Point focus)
Returns a CameraUpdate that shifts the zoom level of the current
camera viewpoint.
A point specified by focus will remain fixed (i.e., it corresponds to
the same lat/long both before and after the zoom process).
This method is different to zoomTo(float) in that zoom is relative to
the current camera.
For example, if the LatLng (11.11, 22.22) is currently at the screen
location (23, 45). After calling this method with a zoom amount and
this LatLng, the screen location of this LatLng will still be (23,
45).
public static CameraUpdate zoomTo (float zoom)
Returns a CameraUpdate that moves the camera viewpoint to a particular
zoom level.

What are the map scales related to mapquest's zoomlevels?

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).

Map view set according to distance

I am a new android developer. I am creating a map view application Where I want to set up my map view according distance from my current location. I have three buttons such as 100m,500m and 1 Km . When application is started then mapview will appear and current location is the center of the map. When i tap on 1 km then the map view is set up 1 km according to current location. How can i do this.Thanks in advance.
You have to compute 1km in latitude and longitude, set the center to your current position ( I guess you succed to do that) and set the span to your MapController:
mController.zoomToSpan((int) spanLat,(int) spanLon);
zoomToSpan
public void zoomToSpan(int latSpanE6,int lonSpanE6)
Attempts to adjust the zoom of the map
so that the given span of latitude and
longitude will be displayed. Because
the zoom can only achieve discrete
levels, and because the aspect ratio
of the map may not match the ratio
given, the quality of the fit may
vary. The only thing we guarantee is
that, after the zoom, at least one of
the new latitude or the new longitude
will be within a factor of 2 from the
corresponding parameter.

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..
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.

Categories

Resources