Guest User

Untitled

a guest
Dec 17th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. <script>
  2. // ... existing map code
  3. // ...
  4. // ... your markers code goes here
  5. document.addEventListener("DOMContentLoaded", function(event){
  6. var container = document.getElementById("wpts");
  7. if (typeof(container) != 'undefined' && container != null){
  8. var wpts = document.getElementById("wpts").children;
  9. var string = null;
  10. var title = null;
  11. var latlng = null;
  12. if (typeof(wpts) != 'undefined' && wpts != null){
  13. for(i=0; i < wpts.length; i++){
  14. if( typeof wpts[i].innerHTML === "string" && wpts[i].innerHTML.length > 0 ){
  15. string = wpts[i].innerHTML;
  16. latlng = string.split(",");
  17. if( parseFloat(latlng[0]) && parseFloat(latlng[1]) ){
  18. //(waypoint)marker
  19. var circle = L.circleMarker([latlng[0],latlng[1]], {
  20. color: '#FF4500',
  21. fillColor: '#FF4500',
  22. fillOpacity: 0.75,
  23. radius: 6,
  24. stroke: false
  25. }).addTo(map);
  26. //popup
  27. if( typeof wpts[i].title === "string" && wpts[i].title.length > 0 ){
  28. circle.bindPopup(wpts[i].title);
  29. }
  30. }
  31. else{
  32. break;
  33. }
  34. }
  35. }
  36. }
  37. }
  38. });
  39. </script>
Add Comment
Please, Sign In to add comment