I'm developing an app in which the user can select points on a Google Maps and create areas based on point-radius and display them on the map with a semi-transparent circle of a specific color. The user is also able to insert "all world" areas. I need to display this "all-world" area on the map, is it possible to add a semi-transparent polygon that cover all the map? Or, is there a better solution to highlight all the map?
Check the documentation of Polygons under the Shapes in Google Maps Android API to cover the map.
Polygon objects are similar to Polyline objects in that they consist of a series of coordinates in an ordered sequence. However, instead of being open-ended, polygons are designed to define regions within a closed loop with the interior filled in.
To create Polygon, first create a PolygonOptions object and add some points to it. These points will form the outline of the polygon. You then add the polygon to the map by calling GoogleMap.addPolygon(PolygonOptions) which will return a Polygon object.
To alter the shape of this polygon, just call the Polygon.setPoints() and provide a new list of points for the outline of the polygon.
Now, for customizing the appearance of the polygon, just check this link. And for the semi-transparent polygon that you want, you can check these tutorial and SO question on how to achieve that.
Related
I am trying to create a dynamic number of points between two points on map. While this is quite easy and can be done by using the dotted lines from PolylineOptions, i also want to animate these points. I don't think there is any way provided by PolylineOptions to animate the dots of that polyline (like in Uber app).
Is there a way to put animated vector drawables on the map? Or do i need to use an MapOverlayLayout on the map surface and draw on it? Or any other way to achieve this effect?
I have a Google map were I draw rectangles.
I have a draggable marker that makes the rectangle change is size as you move your finger.
I do polygon.remove and then create a new polygon with new points (one of the corners is the marker position and I calculate the others)
The resize is working, but the problem is that graphics are slow, you can see the polygon dissapear and reappear.
Is it because of a hardware limitation or there's another better approach?
From the documentation of Google Maps Android API, it is stated in the Polygon part here that to alter the shape of the polygon after it has been added, you can call Polygon.setPoints() and provide a new list of points for the outline of the polygon.
So you must update the shape by calling Polygon.setPoints() rather than adding/removing it.
For more information, just check the link above.
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...
I started Google map in android few days age. I am doing some basic things like set marker on tap, draw line between two marker etc.
Here users can draw polygon with tapping on the device. Now i want to edit the shape. I goggled it but didn't find any helpful solution for android.
I found some resource on google map java script API like user-editable-shapes in javascript
I want to do the same in android. How to Edit or Modify polygon in Google Map Android API
It will be helpful if u provide some resource.
It looks to me like you have to replace all the points at once with setPoints on the polygon object.
https://developers.google.com/android/reference/com/google/android/gms/maps/model/Polygon.html#setPoints(java.util.List)
I'm currently trying to do the same thing in Xamarin. I mock up an edit mode when the user clicks on the polygon by changing its stroke color and then adding custom markers to each vertex. I'm holding a selected vertex which will move to the user's next click on the map and update the polygon.
I'm developing an application that has the following goal:
Using the google maps android API 2 I get my current position, and as I start walking the application starts drawing the route I take
The twist is that the map is a "blind" map. Meaning the map is hidden, only the Marker of my current position and a dotted line of my route is shown.
Keep in mind I'm a novice developing to Android, so please be specific. (Thank you)
I managed to create the map, get my current position and zoom in to it (Had no sens to see the whole planet while i want only my current position). And it's pretty accurate so far.
The thing is I don't know what should I do from this point on.
Basicly I need a white View between the Marker and the real map. Also as I advance that View should always be on, over the MapFragment/MapView. Also I wish to keep the zoom and drag functionality's of the MapFragment.
How can I achieve this?
At this point I'm opened to any solutions.
(Been browsing for a few days now the developers site, I have seen that with the ViewOverlay class I can put messages over the map, but I'm not sure what would the correct aproach be in my case...)
To hide the whole map behind the white view I would use Polygon class Polygon Even if you specify Polygon to cover the whole map Markers will be still displayed in front of it and as so user's current position marker will be visible. You also will be able to zoom and drag.
To draw line on map use Polyline class Polyline It will draw users path as a polyline. If you want to stick with dotted line you can use Circle objects to create it. Circle