New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@turf/geojson-rbush

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/geojson-rbush

GeoJSON implementation of RBush

  • 7.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created

What is @turf/geojson-rbush?

@turf/geojson-rbush is a spatial index library for GeoJSON objects. It allows for efficient spatial querying and manipulation of GeoJSON data using an R-tree data structure.

What are @turf/geojson-rbush's main functionalities?

Spatial Indexing

This feature allows you to create a spatial index from GeoJSON data. The code sample demonstrates loading a GeoJSON FeatureCollection into the R-tree and retrieving all indexed features.

const geojsonRbush = require('@turf/geojson-rbush');
const tree = geojsonRbush();

const geojson = {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [102.0, 0.5]
      },
      "properties": {
        "prop0": "value0"
      }
    }
  ]
};

tree.load(geojson);
console.log(tree.all());

Spatial Querying

This feature allows you to perform spatial queries on the indexed data. The code sample shows how to search for features within a bounding box.

const bbox = [100.0, 0.0, 105.0, 1.0];
const results = tree.search(bbox);
console.log(results);

Spatial Insertion and Deletion

This feature allows you to insert and remove features from the spatial index. The code sample demonstrates adding a new feature to the index and then removing it.

const newFeature = {
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [103.0, 0.5]
  },
  "properties": {
    "prop0": "value1"
  }
};

tree.insert(newFeature);
console.log(tree.all());

tree.remove(newFeature);
console.log(tree.all());

Other packages similar to @turf/geojson-rbush

Keywords

FAQs

Package last updated on 29 Dec 2024

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