Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 1.22 KB

FAQ.md

File metadata and controls

32 lines (22 loc) · 1.22 KB

I'm hiding my map initially, then showing it with jQuery or another script. Why doesn't it show full-size?

Reason: The map can't figure out its own size when it's hidden from the page, since it doesn't have a size in the browser's calculation.

Solution: Call map.invalidateSize() after showing the map:

// your code that shows the map div
$('#map-div').show();

// invalidate the size of your map
map.invalidateSize();

I'm copying coordinates from GeoJSON to Leaflet's L.marker or setView function, and the latitude and longitude are swapped

Reason: the GeoJSON specification says that coordinates must be in longitude, latitude order, while Leaflet uses latitiude, longitude

Solution: swap the order of coordinates when traveling between GeoJSON & Leaflet

L.marker([coords[1], coords[0]]);

Can Mapbox.js read MBTiles?

No: MBTiles files are meant to be read by server-side applications like Mapbox or TileStache and delivered as individual tiles to Mapbox.js. Reading straight from MBTiles would be inefficient since potentially millions of tiles must be transferred in order to view just one.