Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

shapefile

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shapefile

An implementation of the shapefile (.shp) spatial data format.

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
158K
decreased by-0.57%
Maintainers
1
Weekly downloads
 
Created

What is shapefile?

The shapefile npm package is used for reading and parsing shapefiles, which are a popular geospatial vector data format for geographic information system (GIS) software. This package allows you to read shapefiles and convert them into GeoJSON format, making it easier to work with geospatial data in JavaScript applications.

What are shapefile's main functionalities?

Reading Shapefiles

This feature allows you to read a shapefile and log its contents. The code opens a shapefile, reads its records, and logs each record to the console.

const shapefile = require('shapefile');

shapefile.open("path/to/shapefile.shp")
  .then(source => source.read()
    .then(function log(result) {
      if (result.done) return;
      console.log(result.value);
      return source.read().then(log);
    }))
  .catch(error => console.error(error));

Converting Shapefiles to GeoJSON

This feature allows you to convert a shapefile directly to GeoJSON format. The code reads a shapefile and converts its contents to GeoJSON, which is then logged to the console.

const shapefile = require('shapefile');

shapefile.read("path/to/shapefile.shp")
  .then(geojson => console.log(JSON.stringify(geojson)))
  .catch(error => console.error(error));

Other packages similar to shapefile

Keywords

FAQs

Package last updated on 30 May 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc