1

I'm starting use the Leaflet. I put a marker to test but neither the marker nor the center are in the right local I set. example: I put the marker inside a stadium and it appear outside stadium.

There are something I can do to correct this?

var mapquestUrl = 'this is not a link', mapquestAttribution = "Data CC-By-SA by http://openstreetmap.org/' target='_blank'>OpenStreetMap, Tiles Courtesy of http://open.mapquest.com' target='_blank'>MapQuest", mapquest = new L.TileLayer(mapquestUrl, {maxZoom: 18, attribution: mapquestAttribution, subdomains: ['1','2','3','4']}); map = new L.Map('map', { center: new L.LatLng(-8.842, 13.269), zoom: 15, layers: [nexrad], zoomControl: true }); L.marker([-8.815, 13.227], {icon: greenIcon}).addTo(map) .bindPopup('ooooo') .openPopup(); 
2
  • 1
    It will be good if you can share some code. Also take into account how many decimals are you using for the precision of your data Commented Feb 7, 2014 at 14:52
  • My decimals are just 3: L.marker([-8.814, 13.226]).addTo(map) .bindPopup('ooooo') .openPopup(); Commented Feb 7, 2014 at 15:04

1 Answer 1

1

The problem was with the precision of your point (latitude and longitude).

The exact center of the stadium is "-8.8143, 13.226"

Look at my jsfiddle, I just remove some code to make it clear and focus on the solution: http://jsfiddle.net/sLwYG/1/

Hope it help you =)

1
  • Thank you very much Thiago. Is just convert the georeference to new L.LatLng. Commented Feb 7, 2014 at 17:42

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.