How do I draw a area circle overlay underneath a marker?
For instance you would give the area circle an origin coordinate (Latitude, Longitude) and a radius relative to the origin.
So when you zoom in and out of the map the circle will scale with the zoom level correctly.
There is no standard Overlay in osmdroid for that, but it's quite easy to implement that by copying and simplifying this one: DirectedLocationOverlay
Related
I have a map application and cluster of markers. Marker icons are created with BitmapDescriptor.createBitmap. Icons are simple - dot in the center and Gradient circle around it (But this gradient circle should have real-sized radius, meaning if data is 30 meters for the radius - circle should be 30 meters in radius for any zoom level anytime on the map). How can I achieve this, as radiuses in createBitmap argument seem to be dp dependent? I am using ClusterRenderer's onClusterItemUpdated to render a new marker for each zoom level, but can't set a real radius to a bitmap.
Given a MapFragment with any zoom level at any time, is it possible to detect the area covered by the map?
For instace, I'm at Lat: 38.766667 and Lon: -9.15 with the zoom level at 15.0f, how do I calculate the area covered or how do I obtain the top left corner and bottom right coordinates?
you can get the corners of the view area by doing:
googleMap.getProjection().getVisibleRegion().
//farLeft;
//farRight;
//nearLeft;
//nearRight;
//or
//latLngBounds;
Keep in mind that if you have tilting/inclined view the real view area is not a rectangle but a trapezoid.
Have a look at the documentation here to check what is best for you, latLngBounds gives the "smallest" rectangle, that is not the exact area!
https://developers.google.com/android/reference/com/google/android/gms/maps/model/VisibleRegion
I draw a Circle Marker on Google map using the circle option. I have the center point and radius. I want to long/lat of the point on the circle that is x amount of degrees from the X axis. Any idea how?
I am trying to make a map overlay that just shows a solid circle from the map center who's radius is a range in meters.
I can't figure out how to calculate the circle's radius. I can get the map center, but I haven't had any luck figuring out how to convert meters into the proper units for the circle's radius.
Thanks for any help.
I've got no experience of doing this in a gMaps context, but the MapView class (whose getProjection() I'm assuming you've used to work out where your point is on the screen) has getLatitudeSpan() and getLongitudeSpan() which you can use against the screen res to calculate the pixel-radius of your circle.
Client given me a particular area map image. Here I need to get the longitude and latitude of the location at the Touch point on the image.
Is there any way I can work on this issue. To get the location of touch point on the image programmatically.
You can really only do this with any accuracy on a MapView, where you can use the methods
GeoPoint fromPixels(int x,
int y)
Create a new GeoPoint from pixel coordinates relative to the top-left
of the MapView that provided this PixelConverter.
and
toPixels
android.graphics.Point toPixels(GeoPoint in,
android.graphics.Point out)
Converts the given GeoPoint to onscreen pixel coordinates, relative to
the top-left of the MapView that provided this Projection.
to transform lat/on to screen coordinates.
If it's a plain old .png the, as long as the view covers a small area (a few square miles only), you could interpolate the lat/lon at the corners to get an approximate value for the touch point. If it was a whole country, then you would have to apply a coordinate transformation to map from a flat Mercator projection to a curved surface.