Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. var rbu_layer
  2. $.getJSON("getdata.php", function(data) {
  3. var length = data.station_code.length;
  4. var station_code = [];
  5. var localid = feature.properties.localId;
  6. for (var i = 0; i < length; i++) {
  7. station_code[i] = data.station_code[i];
  8. if (station_code[i]==localid) {
  9. var popupContent = localid + "</br>" + station_code[i];
  10. }
  11. }
  12. });
  13. function onEachFeature(feature, layer) {
  14.  
  15. if (feature.properties && feature.properties.popupContent) {
  16. layer.bindPopup(feature.properties.popupContent);
  17. }
  18. layer.bindPopup(popupContent);
  19. }
  20. var map = L.map('map').setView([51.505, -0.09], 3);
  21.  
  22. rbu_layer = L.geoJSON(rbd, {
  23. onEachFeature: onEachFeature
  24. }).addTo(map);
  25. map.fitBounds(rbu_layer.getBounds());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement