Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customized Traffic Layer for Google Maps

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 ?

like image 303
thiagocfb Avatar asked Jun 12 '12 19:06

thiagocfb


People also ask

Can you add custom layers to Google Maps?

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.

How do I add a traffic layer in Google Earth?

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.


1 Answers

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.

like image 61
André Oriani Avatar answered Sep 20 '22 11:09

André Oriani