This package has been deprecated

Author message:

terraformer-geostore is deprecated and no longer supported.

terraformer-geostore

1.0.5 • Public • Published

npm travis

terraformer-geostore

This package is part of the Terraformer project.

Terraformer.GeoStore is a class built for handing lightweight storage and querying large numbers of GeoJSON Features. It is very fast and can index the rough US counties data (~950k features) in about 120ms and do a point in polygon search contains a point in ~6.5ms.

Installing

Node.js

$ npm install terraformer-geostore
$ npm install terraformer-rtree
$ npm install terraformer-geostore-memory

Browser

In the browser, Terraformer is required.

You can use Bower to install the components if you like or download them and host them yourself.

<script src="https://unpkg.com/terraformer@1.0.8"></script>
<script src="https://unpkg.com/terraformer-rtree@1.0.0"></script>
<script src="https://unpkg.com/terraformer-geostore-memory@1.0.0"></script>

Documentation

For a full guide to GeoStore check out the Terraformer website.

var store = new Terraformer.GeoStore({
  store: new Terraformer.Store.Memory(),
  index: new Terraformer.RTree()
});
 
// Add a GeoJSON feature
store.add({
  "type": "Feature",
  "properties": {
    "name": "Ladds Addition"
  },
  "id": "ladds-addition",
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [ [ -122.65355587005614, 45.50499344809821 ], [ -122.65355587005614, 45.512061121601 ], [ -122.64535903930664, 45.512061121601 ], [ -122.64535903930664, 45.50499344809821 ], [ -122.65355587005614, 45.50499344809821 ] ]
    ]
  }
}, function (err, success) {
  // callback when the geojson is added
});
 
// You can also add a FeatureCollection
store.add({
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "name": "Esri PDX"
      },
      "id": "esri-pdx",
      "geometry": {
        "type": "Point",
        "coordinates": [ -122.67629563808441, 45.51646293140592 ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "name": "Barista"
      },
      "id": "barista",
      "geometry": {
        "type": "Point",
        "coordinates": [ -122.67520129680635, 45.51926322043975 ]
      }
    }
  ]
}, function (err, success) {
  // callback when all features are added
});
 
// ask the store which features are within a given polygon.
store.within({
  "type": "Polygon",
  "coordinates": [
    [ [-122.69290924072266, 45.54038305764738], [-122.72054672241211, 45.535453299886896], [-122.69479751586914, 45.51464736754301], [-122.67848968505858, 45.495398037299395], [-122.66836166381836, 45.495398037299395], [-122.66681671142577, 45.50321887154943], [-122.67127990722655, 45.51067773196122], [-122.67127990722655, 45.522585798722176], [-122.67110824584961, 45.53028260179986], [-122.69290924072266, 45.54038305764738] ]
  ]
}, function (err, results) {
  for (var i = results.length - 1; i >= 0; i--) {
    console.log(results[i].id);
  };
});

Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Licensing

A copy of the license is available in the repository's LICENSE file.

Package Sidebar

Install

npm i terraformer-geostore

Weekly Downloads

91

Version

1.0.5

License

MIT

Unpacked Size

46.8 kB

Total Files

7

Last publish

Collaborators

  • esri_dev