Google Map Android API v2 - Apply an overlay outside of a shape - android

Using Google Map Android API v2, I'm trying to apply an overlay outside of a shape. For example, I would like to draw a shape around a marker an apply a grey overlay all around this shape.
Here the result I would like to have : http://www.hostingpics.net/viewer.php?id=221191googlemap.png
I know how to draw a shape and I know how to apply the grey overlay on all the map using the GroundOverlay class but I don't know how to apply the overlay on all the map except in the shape.
I really hope that somebody will be able to help me :)
Thank you in advance !

You can try polygon overlay with holes in the middle. i.e. your entire map is covered by a polygon with an opacity value less then one. You can specify holes in the middle of the polygon. See the documents of polygon overlay:
http://developer.android.com/reference/com/google/android/gms/maps/model/Polygon.html
It says:
A polygon can be convex or concave, it may span the 180 meridian and it can have holes that are not filled in

Related

Google Maps Android api circle bound

I got a question in my mind about how can I bound 2(or more) circle via android api.
The right side of the image is what I exactly want.
this is how can I creating my circle.
circle=mMap.addCircle(new CircleOptions()
.center(geoPoint
.radius(40)
.fillColor(0x12541252)
.strokeWidth(3)
.strokeColor(Color.RED));
I really will be glad, if you suggest me any way to solve my this problem..! thanks in advance!
The order in which this tile overlay is drawn with respect to other overlays (including GroundOverlays, TileOverlays, Polylines, and Polygons but not Markers). An overlay with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays with the same z-index is arbitrary. The default zIndex is 0.
Overlays (such as circles) with higher zIndices are drawn above those with lower indices.
You should use the method mentioned below with Circle and the ZIndex values for both the Circle should be different
public void setZIndex (float zIndex)
To get more help follow this link:
https://developers.google.com/android/reference/com/google/android/gms/maps/model/Circle.html#setZIndex(float)

How to combine, merge or join circles on Google Maps Api V2 Android

This link How to combine circles in Google Maps refer to the same question but not on Android.
So, how can I merge circles like that?
I have 10 markers with its respective circles around them, when the user zoom out it looks fine, but if zoom in, the circles overlapping each other, so, the fill shade of the circle get darker and darker. I want the same shade inside the intersection of the circles or merge the circles.
I want the entire map with shade but the circle clear. So I try using a polygon with shade over the entire map and add circle holes for each marker, but with 6 or more marker doesnt work.
Thank guys...

How to set transparent parts/change color of map polygon on Android?

I have created several polygons over google map which are filled with color
Polygon polygon = mMap.addPolygon(opts.strokeColor(Color.WHITE).strokeWidth(2).fillColor(Color.RED));
I know how to set transparent whole polygon but is is it possible to set transparent only parts of it(change color)?
The idea is, when the user touches the parts of polygon they are set transperent, something similar to this:
Erase bitmap parts using PorterDuff mode
But this example is used for DrawingViews and bitmaps, not for maps and polygons.

Draw segmented circle on Google map v2

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

Android google maps drawing oval instead of circle issue

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.

Categories

Resources