Home › Forums › MapPress Support › Styled maps
- This topic has 7 replies, 3 voices, and was last updated 3 years, 9 months ago by
Chris.
-
AuthorPosts
-
July 22, 2018 at 10:34 am #17892
Did the ability to style maps for MapBox or Leaflet ever exist or is that only if using Google Maps? I can’t find the location in my mappress installation to past json code.
July 24, 2018 at 3:32 pm #17898Hi,
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 URLNow 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');
May 7, 2019 at 3:23 am #18285Hi, Chris-
Have these instructions changed? Or perhaps my understanding is weak 🙂
Under Map Box > Use, I do not see “Develop with this style” or “Leaflet” options.
I did try using the third party URL in the functions.php script (sample below) and changed my shortcode to include “mystyle”, but it did not make a difference on the map.
[mashup query="preserve_region=southern maine" width="100%" zoom="11" style="mystyle"]
May 7, 2019 at 3:24 am #18286Can’t see how to edit, so here’s the shortcode on 2 lines.
[mashup query="preserve_region=southern maine" width="100%" zoom="11" style="mystyle"]
May 7, 2019 at 3:25 am #18288Hi,
The instructions have changed: the ability to specify custom styles is now part of the MapPress settings screen. Have you looked at the docs section for this already?
https://mappresspro.com/mappress-documentation/#toc-mapbox-studio-styles
May 7, 2019 at 3:43 am #18289Yes, thank you. I did see those instructions. However, I am using automatic Leaflet maps generated from custom fields and mashups, and those instructions appeared to apply to the manual editor options: “The new style will appear as a selection in the layers control in the MapPress editor.”
I am looking for a way to apply the MapBox style automatically to all maps (or via shortcode, which brought me to that outdated help thread.
By the way, I did add the share URL to the MapBox Settings (“Styled Maps”) screen, giving it a name of “preserves1″ and used it in my mashup shortcode, but that didn’t change the styling either.
<pre class=”prettyprint prettyprinted”><span class=”pun”>[</span><span class=”pln”>mashup query</span><span class=”pun”>=</span><span class=”str”>”preserve_region=southern maine”</span><span class=”pln”>
width</span><span class=”pun”>=</span><span class=”str”>”100%”</span><span class=”pln”> zoom</span><span class=”pun”>=</span><span class=”str”>”11″</span><span class=”pln”> style</span><span class=”pun”>=</span><span class=”str”>”preserves1″</span><span class=”pun”>]
</span>
<p class=”prettyprint prettyprinted”><span class=”pun”>I also checked to make sure my MapBox base map styling is public, and it is:https://api.mapbox.com/styles/v1/mchtcollier/cjhwbg4m613ho2rpn24azrqt9.html?fresh=true&title=true&access_token=pk.eyJ1IjoibWNodGNvbGxpZXIiLCJhIjoiY2pod2JlcnZ3MTg2djNycG14bXQwYmV1OSJ9.u8CFevFbaKc7En25be_OdA#7.9/44.616/-68.874/-30</span></p>
<p class=”prettyprint prettyprinted”><span class=”pun”>I don’t know what I am missing.</span></p>May 7, 2019 at 3:43 am #18290I have no idea why styles are showing up in my posts and I can’t edit or delete them. Once again:
————————————————————————————
Yes, thank you. I did see those instructions. However, I am using automatic Leaflet maps generated from custom fields and mashups, and those instructions appeared to apply to the manual editor options: “The new style will appear as a selection in the layers control in the MapPress editor.”
I am looking for a way to apply the MapBox style automatically to all maps (or via shortcode, which brought me to that outdated help thread.
By the way, I did add the share URL to the MapBox Settings (“Styled Maps”) screen, giving it a name of “preserves1″ and used it in my mashup shortcode, but that didn’t change the styling either.
The following shortcode is in brackets: mashup query=”preserve_region=southern maine” style=”preserves1″
I also checked to make sure my MapBox base map styling is public, and it is:
I don’t know what I am missing.
May 7, 2019 at 3:47 am #18291I think I see the problem – there is no ‘style’ attribute for shortcodes. Once you set up your custom style in the MapPress settings, you use it in a shortcode with the ‘maptypeid’ attribute:
[mashup maptypeid="preserves1" query="all"]
May 7, 2019 at 8:00 am #18292Bingo, that was exactly what I needed for the shortcode! Thank you.
Is there any way to apply that maptypeid to the automatically-generated maps?
-
AuthorPosts
- You must be logged in to reply to this topic.