Skip to content

jeremy-dl/shapefile-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shapefile-example

Example shapefile upload and visualize on Google Maps v3 API.

To install dependencies run npm install To run the development server run node app.js App will then be visible at http://localhost:3000/

Background

This example is built atop Calvin Metcalf's excellent shpjs npm package. Here it is included inline using the latest verstion hosted from unpkg.com, but any production deployment should pin to a fixed version vendored into the app.

Usage

Inside the index.js file are three functions that accomplish the bulk of the functionality. First is a loadShp function that accepts a FileList object returned from a file input HTML control. Tie that function to the input control's onchange event, and resolve the promose it returns to whatever function is to accept the resulting GeoJSON FeatureCollection, as well as any error handling you need to implement. Note that this function requires the readAsArrayBuffer helper function, which resolves the FileList to a list of ArrayBuffer the shapefile processing library can consume.

About

Example shapefile upload and visualize on Google Maps v3 API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 82.4%
  • HTML 15.5%
  • CSS 2.1%