0

Right now I have a GeoJSON hosted on Azure so I can download it by URL like so:

const geojsonLayer = new GeoJSONLayer({
 url: "www.url.from.azure.com,
 copyright: "USGS Earthquakes",
 popupTemplate: template
});

But it is quite big (~30 MB) and takes a while to load, so what I am trying to do is host it on Azure as a .zip file, download it, and then parse it into JSON. What I then want to do is feed it into the GeoJSONLayer so I can then display it. Is there anyway to do this?

I already have the download a zip file, unzip and parse as a JSON function ready so it would just be displaying the parsed JSON object.

1 Answer 1

1

You can take advantage of createObjectURL to create a URL object that you can set the GeoJSONLayer.url parameter to.

  function createGeoJSONURL(yourgeojson) {
    return URL.createObjectURL(
      new Blob([JSON.stringify(yourgeojson)], {
        type: "application/json"
      })
    );
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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