-
Notifications
You must be signed in to change notification settings - Fork 76
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
Let user upload GeoJSON file of nogos #161
Conversation
Just as a feedback, I'm asking whether the input file can accept also line features in addition to areas. The use case might be simply to pre-select some roads that for some reasons are not usable, and upload portions of roads to be used as no-go "areas". |
It is currently accepting line and polygon features from GeoJSON file. The use case I have in mind is precisely to upload opendata features about road works to avoid them :)
This is a penalty used by BRouter under the hood to compute routing. This is basically a cost proportional to the distance travelled inside the nogo area.
This is already possible in the routing algorithm but not in the frontend yet. See #144 for some discussion about it. |
Although there is no UI for it (yet), the client-side code does support individual weights, you can already pass them with a URL? So I guess it might make sense to read a This would probably also enable to add an export option for nogo areas to GeoJSON later and importing them with this feature again (in part related to #16 and abrensch/brouter#91). |
I pushed a new commit to improve the handling of loading the nogos from geojson. Nogo weight should be used as a fallback value now and points can be imported as circles. The main remaining issue is that the URL hash is not updated when loading the geojson file. By the way, @nrenner do you know any easy way to buffer a geometry in meters in Brouter-web? I usually project in a local representation with meters as units, do the buffering and project back to WGS84 but this is not very usable on a worldwide basis :/ |
Updating the route and hash can be done by adding the following calls after updateRoute({
options: nogos.getOptions()
});
urlHash.onMapMove();
For example with Turf: http://turfjs.org/docs/#buffer To work with Leaflet layers I think you would need to convert with toGeoJSON() methods and back with GeoJSON layer. What is your use case? |
Some additional thoughts:
|
Oh, great, I missed that Turf could do buffering! Typical use case is when using raw OpenData files for road works for instance, sometimes the lines / polygons are very narrow (in the sense that they cover only the very particular portion of the street which is impacted) but not well positioned (with a slight offset or not covering the whole highway from OSM data). Using a bit of buffering is a very easy solution for this. Another reason is when the polygon for the nogo only cover half of the road, but you expect the road works to actually have impact on a much larger area (traffic jam, etc). Thanks for all the feedback, I'll have a look at this during the weekend and update the PR! |
Hi, I should have reworked this code a bit to include the remarks (i18n, UX etc) as well as the buffering. Everything is squashed and rebased against the current The UX part is probably sub-optimal. I think a progress bar could be shown during loading and processing of GeoJSON file for instance, but this is probably fine for a first draft. This should be ready for review and (hopefully) mergeable. Let me know if you have any question or doubt on this. Best, |
Thanks for the update and your contribution!
There is always room for improvement, it's fine as it is. |
Thanks! |
Hi,
This is a very first draft of the ability to create nogos from a GeoJSON file or URL.
This is definitely not yet ready to get merged, I'm just opening this to get feedback, especially on the UI part.
This can be tested on Paris using this GeoJSON export of impacting roadworks for instance: https://opendata.paris.fr/explore/dataset/chantiers-perturbants/download/?format=geojson&timezone=Europe/Berlin.
TODO:
Best,