TooTiredToDrink TooTiredToDrink - 1 year ago 105
Ruby Question

Leaflet Map Rails, Tiles Blank

Using the

gem leaflet-rails

My initializer has the

there is a height to the div:
.mapid { height: 500px; }

Here is my html.erb

<% @imgData.each_with_index do |data, index| %>
<%=image_tag( data['images']["standard_resolution"]['url'] )%>
<div class="mapid" >
<%= map(:container_id => "map" + index.to_s, :center => {
:latlng => [data['location']['latitude'], data['location']['longitude']],
:zoom => 18
}) %>

When I hover on those links for the img src, they are valid and will lead me to a tile.
enter image description here

My tiles get loaded properly. There are no js errors, but nothing is being displayed... Any ideas?

Answer Source

You should give a height to the #map<nr> containers within that outer #mapid container, or you can do .leaflet-container { height:500px }.