Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New module proposal @turf/line-overlap #638

Closed
DenisCarriere opened this issue Apr 2, 2017 · 3 comments
Closed

New module proposal @turf/line-overlap #638

DenisCarriere opened this issue Apr 2, 2017 · 3 comments
Assignees
Milestone

Comments

@DenisCarriere
Copy link
Member

DenisCarriere commented Apr 2, 2017

New module proposal @turf/line-overlap

Returns a collection of intersecting lines that are mutually shared between two lines and/or polygons.

Reason for module: One step closer to removing jsts as a dependency (@turf/intersect test - linestring.geojson) & used to detect if Inner polygons are sharing the same borders of outer polygons when applying @turf/polygon-slice.

Valid input Geometry

  • LineString
  • MultiLineString
  • Polygon
  • MultiPolygon
  • FeatureCollection

JSDocs

/**
 * @name lineOverlap
 * @param {FeatureCollection|Feature<LineString|Polygon|MultiLineString|MultiPolygon>} line1 any LineString or Polygon
 * @param {FeatureCollection|Feature<LineString|Polygon|MultiLineString|MultiPolygon>} line2 any LineString or Polygon
 * @returns {FeatureCollection<LineString>} intersecting lines that share borders between both features
**/

Examples

  • Blue lines (GeoJSON inputs)
  • Red lines (intersections/line that share borders)

image

image

Any thoughts?

CC: @rowanwins

@rowanwins
Copy link
Member

Nice work @DenisCarriere , I imagine this could be handy in a number of cases (although none of them come to me right now!), I'll get it added into the docs when it gets merged in.

Re removing JSTS the martinez repo got an update the other day so it's more stable than it used to be (although don't look at the online demo as that hasn't been updated) so it's a contender for modules like intersection, union, difference, xor.

@DenisCarriere
Copy link
Member Author

DenisCarriere commented Apr 2, 2017

👍 Thanks for your feedback @rowanwins , this module might be slightly on the abstract side, however one scenario that comes to mind is:

  • Detecting if one road overlaps other roads (JOSM warning - Overlapping highways)

@DenisCarriere
Copy link
Member Author

Really cool! The martinez library looks pretty solid (from the readme)

@DenisCarriere DenisCarriere changed the title New module proposal @turf/line-share New module proposal @turf/line-overlap Apr 9, 2017
@DenisCarriere DenisCarriere added this to the 4.1.0 milestone Apr 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants