[OSM-dev] More points on Leaflet map

Giuseppe Ricci peppepegasus at gmail.com
Sat Apr 12 14:11:13 UTC 2014

Hi guys,

I'm new on OSM and, in particular, with Leaflet. I have some problem to
create a map with more points/markers: I have an array (a matrix) where I
have latitude, longitude and description. I have 50 points of interest to
show on the map.
I use for 1 point this code:

<div id="map">
        #map { height: 500px; }
        <script type="text/javascript">
        var map = L.map('map').setView([<? echo $dati[1][5]; ?>, <? echo
$dati[1][6];?>], 9);
//        var map = L.map('map').setView([40.784027, 17.238874], 15);
// 41.133333, 16.85

            attribution: 'Map data © <a
contributors, <a
Imagery © <a href="http://cloudmade.com">CloudMade</a>',
            maxZoom: 18
        var marker = L.marker([<? echo $dati[1][5]; ?>, <? echo
$dati[1][6]; ?>]).addTo(map);
 //       marker.bindPopup("<b><? echo $dati[1][2]; ?></b><br><? echo
$dati[1][3]; ?>").openPopup();
        marker.bindPopup("<b><? echo $dati[1][2]; ?></b><br><? echo
$dati[1][7]; ?>").openPopup();

as suggested in Leaflet Quick Start Guide. If I want to show 50 points
(stored in $dati matrix), what code can I use?
I realized if the description to show in the popup is  long, Leaflet don't
creates the map, how can I solve this problem?
I'm using PHP.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20140412/e34f7728/attachment.html>

More information about the dev mailing list