• Resolved aryanduntley

    (@dunar21)


    I would like to change the map skin/layer/whateveritscalled on the maps I use with this plugin. I’m hoping to avoid having to use the leaflet api directly and discard all plugin UI functionality. Do you have a quick answer on how I can modify the skin using leaflet provider?

    https://leaflet-extras.github.io/leaflet-providers/preview/

    var x = L.tileLayer..

    I have the mapp object but I’m not sure how to modify the skin using it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter aryanduntley

    (@dunar21)

    I’ve tried using the mapp object like so:
    L.tileLayer(…}).addTo(mapp);
    L.tileLayer(…}).addTo(mapp.map);
    L.tileLayer(…}).addTo(mapp.map_);
    L.tileLayer(…}).addTo(mapp.Map);
    L.tileLayer(…}).addTo(mapp.getMap);

    t is undefined or t.addLayer is not a function are all I get. Which means I am either not grabbing the correct object or I’m not using titleLayer correctly… or both.

    Thread Starter aryanduntley

    (@dunar21)

    Ok, with a mixture of browser your documentation and browsing your code I found:

    add_filter(‘mappress_tile_providers’, ‘addMapSkinSrc’, 20);
    in your docs and

    add_filter(‘mappress_baselayers’, ‘addMapBaseLayer’, 20);
    in your code.

    For any reading this, The first filter passes an array that is defined here:
    https://mappresspro.com/mappress-documentation/#toc-google-styled-maps

    So you would add to the option like so: $options[‘stmn’] = array(…).

    The second filter passes also an array but you would add to it like this:
    $baselayers[] = array(‘provider’ => ‘stmn’, ‘id’ => ‘stmn’, ‘name’ => ‘stmn’, ‘label’ => __(‘Stamen’, ‘mappress-google-maps-for-wordpress’));

    This will provide a list of skin providers on the map that a user can choose from.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Leaflet Providers’ is closed to new replies.