How to use the shpjs.parseZip function in shpjs

To help you get started, we’ve selected a few shpjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iTowns / itowns / src / Parser / ShapefileParser.js View on Github external
parse(data, options = {}) {
        let result;

        // If a zip is present, don't read anything else
        if (data.zip) {
            result = shp.parseZip(data.zip);
        } else if (data.shp && data.shx && data.dbf) {
            result = Promise.all([
                shp.parseShp(data.shp, data.prj),
                shp.parseDbf(data.dbf),
            ]).then(shp.combine);
        }

        options.crsIn = data.prj ? proj4(data.prj).oProj.datumName : undefined;

        return Promise.resolve(result).then(res => GeoJsonParser.parse(res, options));
    },
};
github conveyal / analysis-ui / lib / components / import-shapefile.js View on Github external
shapefileRead = (e: ProgressEvent & {target: EventTarget}) => {
    debug(`read ${e.target.result.byteLength} bytes`)
    const shapefile = shp.parseZip(e.target.result)
    const properties = []

    for (const key in shapefile.features[0].properties) {
      if (shapefile.features[0].properties.hasOwnProperty(key)) {
        properties.push(key)
      }
    }

    this.setState({
      shapefile,
      properties,
      nameProp: properties[0],
      freqProp: properties[0],
      speedProp: properties[0],
      error: undefined
    })
github geosolutions-it / MapStore2 / web / client / utils / FileUtils.js View on Github external
shpToGeoJSON: function(zipBuffer) {
        return [].concat(shp.parseZip(zipBuffer));
    },
    kmlToGeoJSON: function(xml) {

shpjs

Load shapefiles in pure JavaScript

MIT
Latest version published 4 months ago

Package Health Score

74 / 100
Full package analysis