I had the same problem in getting started. Some things i found along the way. I created my own tiles using maperative here:
I then uploaded the tiles to a directory (which i later found was not displaying them and the directory had not been set up on the on the server correctly to be visible). If you are using any directories in your html then place it in your browser and make sure it is visible.
My lat/long were the wrong way round (a simple error in copy/paste)
My tiles were not in a directory called "tiles" and so i was pointing to a wrong directory (in my case)
Your bounds/map center may be in the wrong place. I used google earth to set your map center using decimal degrees option, placing the pointer over a spot and writing down the coords.
Use the leaflet url for css/js in case you are pointing to the wrong directory for your css/js
Post your code, its very difficult for people to help without it. I posted my code in another forum and people were very helpful.
This works fine me.... The tiles as i mentioned were created in maperative as i wanted my own custom map and would like to do a little more work on it later
| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Leaflet Quick Start Example</title> |
| <meta charset="utf-8" /> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> |
| </head> |
| <body> |
| <div id="map" style="width: 100%; height: 600px"></div> |
| |
| <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> |
| <script> |
| |
| var map = L.map('map').setView([38.738853, 0.039328], 13); |
| bounds = new L.LatLngBounds(new L.LatLng(38.589932205137842, -0.24943472068649825), new L.LatLng(38.834130125688162, 0.250210265053367)); |
|
|
|
|
|
|
| |
| |
| L.tileLayer('http://tiles.primarysolutions.org/tiles/{z}/{x}/{y}.png', { |
| minZoom: 12, |
| maxZoom: 15, |
|
|
|
|
|
|
| attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
| '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + |
| 'Imagery © <a href="http://mapbox.com">Mapbox</a>', |
| }).addTo(map); |
| |
| </script> |
| </body> |
| </html> |