This module works great for the official set of Mapbox tiles that you see here: http://tiles.mapbox.com/mapbox - When you add any of those names while creating a new Mapbox Layer with the OpenLayers module, we get the correct set of tiles.

However when you try to create a Mapbox layer using the name of a custom map, that a user has created with TileMill and uploaded to his account for example, the set of tiles are not displayed.

If a user could especify the username of the uploader and the name of the map (I'm guessing the mapbox username is 'hardcoded'), this would be possible right?

Custom Mapbox map example: https://tiles.mapbox.com/ipwa/map/world-vision-peru

Comments

antoniotorres’s picture

I ran into that issue and it is in fact hardcoded. Here's how I got around it (hack incoming)

open mapbox.layers.inc

add this and customize.

function _mapbox_layers_info() {
  $info = array();
   $info['mapbox_mapname'] = array(
    'name'=> t('Map Name'),
    'description' => t('Map Name'),
    'layername' => 'map-theMapIdHere',
    'minzoom' => 0,
    'maxzoom' => 16
  );

then scroll down and look for

    $openlayers_layers->data = array(
      'urls' => array(
        0 => 'http://a.tiles.mapbox.com/YOURUSER/',
        1 => 'http://b.tiles.mapbox.com/YOURUSER/',
        2 => 'http://c.tiles.mapbox.com/YOURUSER/',
        3 => 'http://d.tiles.mapbox.com/YOURUSER/',
      ),

and replace, then enable.

Hope this helps you and everyone else that has the same issue.

antoniotorres’s picture

Tempted to patch the entire module to expose that stuff through the interface.

ipwa’s picture

Tempted to patch the entire module to expose that stuff through the interface.

That would be so so, awesome!!

Thanks for the tip, will try it out.

ipwa’s picture

Issue summary: View changes

Adding custom map link

ipwa’s picture

Issue summary: View changes

As now seen in the module page (and soon in the docs), it is possible to implement your custom Mapbox tiles as a new XYZ layer for the OL module using some simple instructions.

ipwa’s picture

Status: Active » Closed (outdated)