question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

does turf.intersect work for spatially querying more than 2 polygons OR what library OR workaround is recommended?

See original GitHub issue

I have a GeoJSON of meshed/connected/neighboring polygons and want to onclick of a single polygon, select those polygons that interesect (a.k.a. border) the clicked polygon.

I was thinking of using turf.intersect to do this. However, the docs only describe 2 polygons as being the arguments.

OR I think (if needed as a workaround using TurfJS) I could use turf.buffer buffering the polygon centroid to select the neighboring polygons? turf.buffer

Hoping to get a nudge in the right direction here. I haven’t had luck finding my use case in open issues, GIS SE or SOflow. Any recommendations would be super appreciated.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DenisCarrierecommented, Feb 28, 2017

GeoJSON writer is a tool I built to save compact GeoJSON to the file system, if your application is entirely web based, I wouldn’t be using that library.

Use that source code as a general guideline, try to extract some of the rbush components of it.

I built that OSM Ottawa code for a very specific one of project, so there’s definitely some improvements to do.

1reaction
DenisCarrierecommented, Feb 14, 2017

@shawnmgoulet Well I have a pretty complex example from one of my public repos.

https://github.com/osmottawa/data-research/blob/master/Ottawa-Buildings/align-address.js

The data is not provided in the repo, however you can preview the data here.

What the script does:

  • Selects an address
  • Finds the property parcel inside that address
  • Finds all the buildings inside that parcel
  • Align address with largest building inside parcel

Might be useful to look at the syntax

Read more comments on GitHub >

github_iconTop Results From Across the Web

Intersecting FeatureCollections in turf.js? - GIS Stack Exchange
Most files in the wild are FeatureCollections. An intersect that can only work with Polygons isn't terribly useful or maybe it's just me....
Read more >
Advanced geospatial analysis - Turf.js
Takes one or more features and calculates the centroid using the mean of all vertices. This lessens the effect of small islands and...
Read more >
How to intersect more than 2 polygons using Turf.js?
turf.intersect() can only intersect 2 polygons. If you want to intersect multiple polygons you can intersect each polygon with each other ...
Read more >
Chapter 10 Bridges to GIS software | Geocomputation with R
You can interact with QGIS, SAGA, GRASS and gvSIG from system terminals and embedded CLIs, ... relational data models, topology and fast (spatial)...
Read more >
Clip Data - QGIS Introduction - LibGuides at Duke University
Spatial Query : This tool will use 2 shapefiles to select features ... Click on the Raster menu, mouse-over Extraction, and click on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found