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 ?
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
Overlaysubclass, overriding thedrawmethod to paint over the streets. You would have to useMapView.getProjection()to get theProjectionobject, so you can map coordinates to pixels on theMapViewto draw the traffic indicators.I hope I have somehow helped.