0

How do I make a URL a hyperlink when the information is called from a GeoJSON field? I have tried adding html tags, but since the link is not in-line, it does not work. (Script below) LOC_Catalo is the field with the URL.

Non-Clicking Link

  // load GeoJSON from an external file
 $.getJSON("Syriashape.json",function(data){
// add GeoJSON layer and popups to the map once the file is loaded
L.geoJson(data, {
   style: function (feature) {
   return {};
   },
   onEachFeature: function (feature, layer) {
       layer.bindPopup(feature.properties.Sheet_Numb + "</br>" + "  " + feature.properties.LOC_Catalo);
   }
}).addTo(map);
  });
2

Just like you added a </br> tag, you should be able to add an <a> tag:

// load GeoJSON from an external file
$.getJSON("Syriashape.json",function(data){
  // add GeoJSON layer and popups to the map once the file is loaded
  L.geoJson(data, {
    style: function (feature) {
      return {};
    },
    onEachFeature: function (feature, layer) {
      layer.bindPopup(feature.properties.Sheet_Numb + "</br>" + "<a href='" + feature.properties.LOC_Catalo + "'>" + feature.properties.LOC_Catalo + "</a>");
    }
  }).addTo(map);
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.