Skip to content

Instantly share code, notes, and snippets.

@IReese
Created November 27, 2019 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IReese/a5975202cfe645e98e034949de22c896 to your computer and use it in GitHub Desktop.
Save IReese/a5975202cfe645e98e034949de22c896 to your computer and use it in GitHub Desktop.
var shapefile = require("shapefile");
const cover = require('@mapbox/tile-cover');
const fs = require('fs');
async function main() {
const shp = await shapefile.read("~lds-nz-imagery-surveys-SHP/nz-imagery-surveys_wgs.shp")
console.log(shp)
var limits = {
min_zoom: 12,
max_zoom: 13
};
const newShp = shp.features.find(feats => feats.properties.name == 'Gisborne 0.1m Urban Aerial Photos (2017-2018)')
var tilesOut = cover.geojson(newShp.geometry, limits)
var output = console.log(JSON.stringify(tilesOut))
fs.writeFileSync('output.geojson', JSON.stringify(tilesOut))
}
main().catch(e => console.error(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment