0
votes

I'm trying to implement Leaflet with Mapbox tiles/styles in my webapp but am stuck. I'm using the geocoder gem to translate addresses into latitude/longitude, which is working great.

However, attempting to display the maps leaves me with this: enter image description here

I'm using the leaflet.rb config file, which looks like this:

Leaflet.tile_layer = "https://api.mapbox.com/styles/v1/mapbox/outdoors-v10.html?title=true&access_token={my access token}#2/0/0"
Leaflet.max_zoom = 18

If I load the tile layer url in the browser, it works fine. It just won't display within the app. The code I'm using to display is below:

                  <div id="map">
                    <%= map(
                      :center => {
                        :latlng => [ @event.latitude , @event.longitude  ],
                        :zoom => 10
                      },
                      :markers => [{
                        :latlng => [ @event.latitude , @event.longitude  ],
                      }]
                     ) 
                    %>
                  </div>

Any help would be appreciated!

1

1 Answers

0
votes

Figured it out after talking with Mapbox customer support. Correct format was:

https://api.mapbox.com/styles/v1/mapbox/outdoors-v10/tiles/{z}/{x}/{y}?access_token={my access token}