Giter VIP home page Giter VIP logo

terraformer's Introduction

Terraformer

  • Convert to and from ArcGIS JSON Geometries, WKT and GeoJSON
  • Manipulate GeoJSON with methods like addVertex
  • Find out if GeoJSON shapes intersect or contain each other
  • Get properties like bounding boxes, envelopes, and convex hull of GeoJSON objects
  • Respresent circles as GeoJSON Features
  • Convert to and from Geographic Coordinates and Esri Web Mercator spatial references

Gizipped and minified all Terraformer modules comes to about 9.6kb. The core library is 2.8kb and includes GeoJSON parsing, helper methods, bounding boxes and spatial reference conversions. Other features are available as add-in modules as needed.

Using

Node.js

Terraformer on Node.js is split into multiple small packages for easy consumption.

$ npm install terraformer
$ npm install terraformer-rtree
$ npm install terraformer-wkt-parser
$ npm install terraformer-arcgis-parser

Browser

Terraformer can be used in the browser with a simple browser include.

<!-- Load the main terraformer library -->
<script src="terraformer.min.js" type="text/javascript"></script>

<!-- Load the wkt parser -->
<script src="wkt.min.js" type="text/javascript"></script>

<!-- Load the arcgis parser -->
<script src="arcgis.min.js" type="text/javascript"></script>

<!-- Load the rtree index -->
<script src="rtree.min.js" type="text/javascript"></script>

AMD (Require.js and Dojo)

Terraformer also works with AMD loaders like RequireJS and Dojo.

RequireJS

First you should register the Terraformer modules with RequireJS

requirejs.config({
  //In order for proper loading of depenencies in Terraformer modules set the path up in requirejs.config
  paths: {
    terraformer: "/the/path/to/terraformer"
  }
});

Then you can load Terraformer modules in your require statements.

requirejs([
  "terraformer/terraformer",
  "terraformer/wkt",
  "terraformer/rtree",
], function (Terraformer, TerraformerWKT, RTree) {
  // Do stuff with terraformer core, wkt parser, and rtree
};
Dojo

Dojo includes a built in AMD loader. To use Terraformer with Dojo setup the path to Terraformer in your dojoConfig.

dojoConfig= {
  async: true,
  packages: [{
    name: "terraformer",
    location: "/the/path/to/terraformer"
  }]
}

You can then include Terraformer in your Dojo code

require([
  "terraformer/terraformer",
  "terraformer/arcgis",
  "terraformer/rtree",
], function (Terraformer, TerraformerArcGIS, RTree) {
  // Do stuff with terraformer core, arcgis parser, and rtree
});

WebWorkers

Sample code and examples coming soon...

Documentation

Basics

Parsers

Indexes

Tools

Examples

Testing

Tests are written in Jasmine and can be run through $ grunt or $ npm install then $ npm test. To run the tests run the following commands to setup PhantomJS and Grunt...

  • $ npm install grunt -g
  • $ brew install phantomjs

Then run the tests with $ grunt which will buld all the files and then run the tests. You can also run $ grunt watch which will run the tests when source files change.

Building

Running the $ grunt build command will build the libraries to dist/node and dist/browser. If you want to build with a different version number run $ grunt build-versioned.

Future Features

  • GeoJSON validation
  • Google Maps format support
  • Leaflet format support

Known Issues

The following are known issues that we have acknowledged but have not or will not fix. See individual issues for details.

  • Convert an array of ArcGIS Geometries/Graphics to a GeometryCollection/FeatureCollection. Esri#104

[](Esri Tags: Terraformer GeoJSON WKT Well-Known-Text) [](Esri Language: JavaScript)

terraformer's People

Contributors

aaronpk avatar jcardonadcdev avatar jerrysievert avatar kyledrake avatar mhogeweg avatar patrickarlt avatar ungoldman avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.