I've been trying to display Google Maps traffic layer in my app, from what i've studied it should be displayed after setting
mapView.setTraffic(true);
to my MapActivity, however, i wasnt able to make it appear.
After some research i've found out that Google Maps API doesnt support Traffic Layer for my Region (São Paulo, Brazil) at least, not through using their API since it IS possible to check the Traffic Layer for my region if i use Google Maps itself.
My main question is : Is it possible to create some kind of customized traffic layer using my own database for traffic situation over Google Maps displayed map? How could i paint streets according to their traffic status ? I don't think overlays would be enough for this job.
Any thoughts ?
Edit1: Still researching this, maybe the only way would be to try to minimize the map, use customized overlays and offer labels to explain each overlay ?
Open or create a map. You'll see your layers in the box on the left. Make the changes you want. Add a layer: Click Add layer.
Follow the steps below to display traffic layer in Google map: Step 1 Go to Add Or Edit Map and scroll down to 'Layers Settings' section. Step 2 Enable or tick 'Traffic Layer Tab'. Step 3 Then click on Save Map.
I wish I could do a comment instead of an answer but I still do not have that power.
I am guessing that the license agreement between Google and the company that provides traffic data for the City of Sao Paulo does not allow the use by 3rd parties (i.e, developers using Maps API). That is the only reasonable explanation I came up for having traffic data on Google Maps for São Paulo but not in the own Google's example for traffic layer on Maps V3 API
So I think the only option is the one you mentioned. If you have you own database with traffic data, you could create you own Overlay
subclass, overriding the draw
method to paint over the streets. You would have to use MapView.getProjection()
to get the Projection
object, so you can map coordinates to pixels on the MapView
to draw the traffic indicators.
I hope I have somehow helped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With