Closed markstos closed 3 years ago
Thanks for raising - certainly an interesting problem. I actually hadn't come across the concept before so cool to learn something new! I think the problem is that GeoJSON doesn't lend itself well to determining networks and network topology. Libraries tend to opt for shared coordinates between LineStrings to determine shared network points - but there's no standardised way to determine topology.
My concern here with a module like this is that we don't currently have any modules relating to graphs/networks and this personally feels to me like a more niche module we would add on top of something like creating a graph data structure from a FeatureCollection
Hi @markstos
I'm with @JamesLMilner on this one, sounds very neat library idea but probably doesn't quite fit the way Turf operates.
I'd recommend checking out the ngraph library , it provides a nice API for building graph data structures which really lend themselves to this sort of problem.
Cheers
Thanks for the feedback, I'll close this.
As a citizen-mapper, I've been seeing if I could use public data sets to build an objective map of where sidewalks should be prioritized for funding in my town, based on things like the walk potential of the area and building density.
I keep finding new ways to improve my approach, but Turf.js has become my core tool I'm using for the spatial analysis.
Here's a draft map of missing and poor condition sidewalk locations ranked by priority to fix them:
https://amigoshub.maps.arcgis.com/apps/mapviewer/index.html?webmap=2e121c7a721d421c8a8e6b759e05540d
Short cul-de-sacs usually don't need sidewalks due to low volume and low speeds of car traffic, so it will be helpful if I figure out a way to detect those in the "road centerline" LineString FeatureCollection so I can de-prioritize them.
To find cul-de-sacs and in a road network and other uses, calculating the valency of of points is helpful.
https://gis.stackexchange.com/a/48270/9410
https://desktop.arcgis.com/en/arcmap/latest/extensions/data-reviewer/checking-valency.htm
To calculate the valence of a single point it seems you have you to scan the entire LineString or MultiLineString, so a function would produce a valence table or valence object. The object might be used to look up the valence of a single point. Maybe:
Internally, the valence table might be represented a an object that maps points stored as a coordinate strings to the valency of the point represented as a number.
I can't find any modules on NPM that currently solve this.
As I understand, the valency would be equal to the number of times that a given point appears as a coordinate pair in line segments.