bozdoz / wp-plugin-leaflet-map

Add leaflet maps to Wordpress with shortcodes
https://wordpress.org/plugins/leaflet-map/
GNU General Public License v2.0
141 stars 72 forks source link

Tiles are returning 410 gone errors #191

Closed dovidev closed 1 year ago

dovidev commented 1 year ago

Using the Map Tile URL of https://api.tiles.mapbox.com/v4/mapbox.light/{z}/{x}/{y}.png?access_token=REDACTED, I get errors that look like this:

GET https://api.tiles.mapbox.com/v4/mapbox.light/4/6/5.png?access_token=REDACTED 410 (Gone)

I saw some things that said to use this URL instead: https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=REDACTED

However, when I tried that, I get

Error: No value provided for variable {id}

bozdoz commented 1 year ago

Should those urls work?

dovidev commented 1 year ago

Should those urls work?

Yes, they should work. Obviously, my access token has been redacted so the links here won't work. This worked great until recently when it just stopped working.

dovidev commented 1 year ago

bozdoz added the [needs more info]

What more info do you need?

hupe13 commented 1 year ago

Maybe you can get info here. https://raw.githubusercontent.com/leaflet-extras/leaflet-providers/master/leaflet-providers.js

bozdoz commented 1 year ago

When I try your URL, I get:

Classic styles are no longer supported; see https://blog.mapbox.com/deprecating-studio-classic-styles-d8892ac38cb4 for more information

This is irrelevant to this plugin.

dovidev commented 1 year ago

When I try your URL, I get: Classic styles are no longer supported;

@bozdoz What did you do to get that message? If I try to access the URL directly or with cURL, I get

{"message":"Forbidden"}

dovidev commented 1 year ago

I'm seeing that Mapbox has changed some things. What I'm not seeing is what I need to put in this leaflet field to make the plugin work.

bozdoz commented 1 year ago
Screen Shot 2022-12-22 at 1 27 22 PM

I'm not sure what mapbox needs now. I haven't looked into it. I suspect the answer is in that link: https://blog.mapbox.com/deprecating-studio-classic-styles-d8892ac38cb4

bozdoz commented 1 year ago

My guess is they want you to create a new map (which gives you the {id} you may or may not be looking for): basically style your own map under your own account, and use that

dovidev commented 1 year ago

I'm confused. Where would I create a map? I'm using Leaflet Map Version 3.0.5 which has a series of shortcodes to use. Here's what my code looks like.

[leaflet-map height=450 lat=37.8 lng=-92.5 zoom=4 min_zoom=3 max_zoom=15 doubleClickZoom zoomcontrol !scrollwheel]       
[leaflet-geojson src="https://aquissolutions.com/wp-content/themes/astra-child/coverage-map.json.php"]{name}[/leaflet-geojson]
bozdoz commented 1 year ago

It's in the README:

[leaflet-map tileurl="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"]

here: https://github.com/bozdoz/wp-plugin-leaflet-map/blob/master/README.md?plain=1#L134

And in the example page:

https://github.com/bozdoz/wp-plugin-leaflet-map/blob/master/templates/shortcode-helper.php#L75

bozdoz commented 1 year ago

Please re-open if you believe this issue is still relevant

dovidev commented 1 year ago

That got the map to show but it doesn't read in my .json for regions as it did before. What do I need to do to make that work.

<div id="coverage-map">      
[leaflet-map height=450 lat=37.8 lng=-92.5 zoom=4 min_zoom=3 max_zoom=15 doubleClickZoom zoomcontrol !scrollwheel]       
[leaflet-geojson src="https://aquissolutions.com/wp-content/themes/astra-child/coverage-map.json.php"]{name}[/leaflet-geojson]       
</div>
<script src="https://aquissolutions.com/wp-content/themes/astra-child/coverage-map.js?t=20230111103707"></script>
dovidev commented 1 year ago

I've updated my last comment to include the actual javascript reference. Including that Javascript or not does not change that the json for regions overlayed on the may doesn't work. I'm just trying to figure out how to use this plugin now that something has changed. As far as I can tell, I'm using the most up-to-date version of the plugin. The page is here: https://aquissolutions.com/coverage/. How should this be done?

dovidev commented 1 year ago

Got it figured out. It looks like it was also throwing an invalid json error. The JSON itself was valid but one of the features didn't have the geometry type set. In looking at the code there, it would be really easy to change that error message to actually say that's what's going on instead of saying the JSON was invalid.