diff --git a/resources/public/index.html b/resources/public/index.html index a7413ef..fc55cb9 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -1,7 +1,7 @@
-" + k + " | " + @@ -85,21 +90,26 @@ var GeoCSV = { addPin( record, index, view) { var lat = Number( record[ "latitude"]); var lng = Number( record[ "longitude"]); - var pin = L.icon( {iconAnchor: [16, 41], - iconSize: [32, 42], - iconUrl: "img/map-pins/" + - this.pinImage( record) + - ".png", - riseOnHover: true, - shadowAnchor: [16, 23], - shadowSize: [57, 24], - shadowUrl: "img/map-pins/shadow_pin.png"}); - var marker = L.marker( L.latLng( lat, lng), - {icon: pin, title: record["name"]}); - marker.bindPopup( popupContent( record)); - marker.addTo( view); - return marker; + if ( !isNaN( lat) && !isNaN( lng)) { + var pin = L.icon( {iconAnchor: [16, 41], + iconSize: [32, 42], + iconUrl: "img/map-pins/" + + this.pinImage( record) + + ".png", + riseOnHover: true, + shadowAnchor: [16, 23], + shadowSize: [57, 24], + shadowUrl: "img/map-pins/shadow_pin.png"}); + var marker = L.marker( L.latLng( lat, lng), + {icon: pin, title: record["name"]}); + marker.bindPopup( this.popupContent( record)); + marker.addTo( view); + + return marker; + } else { + return null; + } }, removePins( view) { @@ -143,10 +153,15 @@ var GeoCSV = { }, refreshPins( view, records) { - removePins( view); - record.forEach( r => { - }); - computeBounds( view, records); + this.removePins( view); + + for ( i = 0; i < records.length; i++) { + if( records[i]) { + this.addPin( records[i], i, view); + } + } + + this.computeBounds( view, records); } }, @@ -208,7 +223,7 @@ var GeoCSV = { this.Notify.message( "Found " + records.length + " records of inline data for map " + id); - this.Gis.refreshPins( view, records); + this.GIS.refreshPins( view, records); } } } |
---|