I want to draw a a circle of 15 KM radius around a point on Google Maps by using Android.
In Android we only have MapView and MapViewController. How can I implement the drawCircle funciton provided in Google Map Circle example in Android.
You must implement Overlay.
And draw circle like in FixedMylocationOverlay in draw method.
Related
i am developing an android app using osmdroid. I am drawing an overlay on the map, depending where your current location is. Depending on the zoomlevel should the overlay get more details (level of detail). In other words, i have to draw the overlay on every zoomlevel. My Problem is the onCreate function is called only once and so is my function to draw the overlay.
I have to optimize the overlay algorithm. The overlay i am drawing on the map should be detailed as necessary and not more. On a zoomlevel of 0, it is not necessary to draw a little polygon with several thousands points.
I want to draw zones/coverage areas on map in form of circle. Now first I draw circle from this tutorial I implemented all same code from that tutorial. Now I draw a circle of radius 150 meter but I came to know that I have to change that 150m to some other unit may be pixel which gives me actual radius on which circle should be drawn . For this I went through number of sites some advised to use metersToEquatorPixels- which is not in Google map V2 and other methods but they are not giving solution from where I can sure that is the correct radius to draw on Map. More over come says radius will be calculate according to zoomLevel/scale. I tried all methods which was giving on internet but did not get success.
Any will be appreciated.
I need circle under which map can move but not the circle
I know how to draw a a circle on map v2 using circle options. However I was wondering, is there a way I can segment the circle (sort of like into Arcs)
Found the answer. It can not be done using CircleOptions. I will have to create custom view and add it on the map
I have been working on google maps v2 drawing a circle which can be resized on dragging circumference of the circle.
Cirlce circle = mMap.addCircle(new CircleOptions()
.center(center)
.radius(radius)
.strokeWidth(2)
.strokeColor(Color.BLUE)
.fillColor(Color.parseColor("#500084d3")));
Now problem comes for large value of radius the circle becomes and oval.
I have referred these link and also linkbut didnt find any solution:
These links says that
"
the reason you're getting ellipse it's because the math on the options.add( is very basic and pretends the earth is a flat surface, just like before Copernicus. If you draw it on smaller areas you'll get a rounder circle. If you want a precise circle you'll have extend that math to proper take into account the shape of Earth "
Is there any solution to this problem.
Is use of class extending Overlay recommended in google maps v2 so that I can somehow use its onDraw(..) method.
Heatmap - Generating Simple 'HeatPoint' Google Maps Android
SO the above seems to suggest i can do this, however I am not convinced.
Here is what I am doing
CircleOptions circleOptions = new CircleOptions()
.center(center)
.radius(distance.distanceInMeters)
.strokeColor(getResources().getColor(R.color.brand_color_very_faded))
.strokeWidth(8F)
.fillColor(getResources().getColor(R.color.brand_color_faded)); // In meters
// Get back the mutable Circle
Circle circle = mMap.addCircle(circleOptions);
Which works fine, however I would really like to use a smooth gradient color, is this possible?
Or am i going to have to add a marker at each point, with a bitmap gradient (not what I want to do)?
Any help would be appreciated thanks!
The question you are referring to talks about drawing on Bitmap using Canvas, not about using CircleOptions. I suggest following it and also using TileOverlay or GroundOverlay depending on how many of these circles you may have.