Render transit layer on Android Google Maps

145 Views Asked by At

What we have achieved so far is to be able to use MAP IDs on our Android project and configure Map Styles dynamically on our application. Recently though we are attempting to showcase transits specifically involving subway_station[Metro] to let users walk through these routes. In order to do that we would want to display the metro lines evidently rendered on our map.

A follow-up attempt on this is where we have tried to enable and fill in the transit.line with the help of style references using a custom color e.g. Blue.

On the other hand, on a Web client, we have tried using a similar styling with MapStyleOptions customized over for a transit layer, and achieved the following as expected: enter image description here

Looking for hints into the right direction or possible open-source solutions to achieve this over Android.

1

There are 1 best solutions below

0
N Dorigatti On

I don't think you can do it with styling on Android (there is a traffic layer but not a transit layer). What you can do could be either:

  1. Add Shapes. It means download/pack the polylines of the metro you want to show and add them to the map with your custom styles as Polylines Shapes
  2. Use map services. It means you have to publish/find online services (usually WMS Web Map Services) that expose the metro layers and add them to your Google Maps. I currently don't know if there are free services, if not, given that you find the metro shapes, you can start your own free map service called Geoserver and setup a WMS using the obtained data. On Android you can add WMS services easily, see my old answer

What to choose is up to you. With downloaded shapes you can give full Android Maps API rendering and offline capable maps at the cost of having the metro data/downloading data (how many cities?). Otherwise you can have an online service that is light, quick and flexible in terms of styling, that you can update immediately, at the cost of having a server and requiring your users to be online most of the time (you can cache WMS downloaded pictures, but you have to show them at least once).

I hope I helped you, if you need further help, please ask!