Loading a remote url

Works in both NodeJS and the browser.

Assumes the .shp and sidecar files can be found alongside eachother.


const url = "https://cdn.rawgit.com/mbostock/shapefile/master/test/points.shp"

const points = new ShpToGeoJson({
  remotePath: url
})

// Call .load() and wait for the promise to be resolved
points.load()
.then(() => {
    
  // Call the .getGeoJson() method
  const featureCollection = points.getGeoJson()
  const pointsLayer = L.geoJSON(featureCollection).addTo(map)
  
  // Automatically zoom to the data
  map.fitBounds(pointsLayer.getBounds())
})
.catch((err) => {
  console.error(`shp-to-geojson error: ${err.message}`)
})