I am in the process of migrating a website from the Google Maps API to OpenLayers 3.

This site shows a map with custom tiles and administrative labels and borders on top of them (country/region/city limits and names). This uses a transparent overlay, where features are selected using a Google Maps styled map (i.e. leaving the roads and labels on, but disabling the terrain features).

I have tried selecting an OpenStreetMaps layer as an overlay (transparent: true, opaque: false), but the OSM layer fully occludes the custom layer below. Only the labels and borders should be visible in this layer.

So far, the options I have found are:

  • Create a custom layer styling OSM data. As I understand, in case of OSM this is not something I can request dynamically from the OSM website (as it is the case with Google's Styled Maps); I would need to prepare data and serve it from my own web server (which is already at the limit of the number of files allowed).
  • CartoDB offers 2 layers with only labels: https://cartodb.com/basemaps, with basemap names "light_only_labels" and "dark_only_labels". Whereas this is close to solution, these layers are missing the administrative borders (countries, regions, etc).
  • Embed a Google Maps layer on top of the map, using https://github.com/mapgears/ol3-google-maps
  • Overlay a vector layer over the map. I have seen an example at http://openlayers.org/en/v3.2.1/examples/image-vector-layer.html , but the result is too simple, only containing some minor detail of countries, but no regions, cities, names, etc.

Are there other ways to overlay administrative labels and limits on top of a custom map, using OpenLayers 3?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.