geotools-java
Bridge API to connect node.js with geotools Java APIs
Other projects that might be helpful
- geotools - Open source Java library that provides tools for geospatial data.
- node-java - Bridge API to connect with existing Java APIs.
Installation
$ npm install --save geotools-java
Notes:
- Refer to node-java for node-java installaton prerequisites
Installation Prerequisites
- JDK 8 or newer, Apache Maven, C++ compiler, python 2.7.x, zip, unzip
GeoTools Build and Packaging
- The npm install process clones the geotools repo to node_modules/geotools.
- The geotools JAR files and dependencies are packaged using te Maven Shade Plugin.
- The geotools repo is cloned and then a maven build is initiated by make-geotools.sh
- The makegt-jar.sh script is used to generate an Uber JAR containing the dependencies:
$ ./make-geotools.sh ./geotools$ ./makegt-jar.sh
- The packaged geotools dependencies are placed in geotools-java/src/gt-jar/target/node-geotools-1.x.jar
Simple Example
const geotoolsFactory = ; { const className = 'org.geotools.data.shapefile.ShapefileDataStoreFactory'; const shapeFileStorePath=__dirname + '/../geotools/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes'; // Will hang on OSX without these options const opts = vmOptions: '-Djava.awt.headless=true' '-Dawt.toolkit=sun.awt.HToolkit' ; const geotools = await geotoolsFactory; const java = geotools; const factory = geotools; const params = geotools; const store = factory; const names = store; const typeName = 'polygontest'; const fs = store; const features = fs; const fjson = geotools; console;};
Release Notes
v0.4.0
- Revise geotools build scripts
- Add Java VM options to eliminate hang on OSX
v0.1.0
- Initial release