Hot answers tagged

3

You have a JSON but Leaflet really likes geoJSONs, so you should convert the JSON to geoJSON first, or directly load a geoJSON. So for your example, if you have: var data =[{ "latitud": 43.526523590087891, "longitud": -5.6150951385498047 }, { "latitud": 43.511680603027344, "longitud": -5.6671133041381836 }, . //More Lat-Lng Points . { "latitud": 43....


2

As an alternative to @Joran's approach, you can skip GeoJSON completely and just iterate through the points, creating instances of L.LatLng and L.Marker as you go, like: var points = [{ "latitud": 43.526523590087891, "longitud": -5.6150951385498047 }, { "latitud": 43.511680603027344, "longitud": -5.6671133041381836 }, ...



Only top voted, non community-wiki answers of a minimum length are eligible