Reply To: Styled maps

Home Forums MapPress Support Styled maps Reply To: Styled maps

#17898
Chris
Keymaster

Hi,

The plugin supports MapBox Studio styled maps for Leaflet (as well as Google styled maps). But you need to use the latest MapPress (2.49.7) and create a PHP filter.

I’ll write this up more fully in the documentation, but here’s an overview.

MapBox Studio is here:
https://www.mapbox.com/studio/styles/

After you make your Studio style, get its URL:
1) Click the menu next to the style, select ‘share, develop and use’
2) Scroll down to ‘develop with this style’
3) Go to the ‘leaflet’ tab. Copy that URL

Now edit your theme’s functions.php file and create a filter to add the new style. Replace with the URL from step 3 above:

<?php
function mystyles($baselayers) {
  $baselayers[] = array(
    'provider' => 'mapbox-studio',
    'id' => 'mystyle',
    'name' => 'mystyle',
    'label' => __('My style'),
    'url' => '<YOUR URL GOES HERE>'
  );	
  return $baselayers;
}

add_filter('mappress_baselayers', 'mystyles');