Graphhopper flexible routing ignore street segment - graphhopper

I've read alot about flexible queries but unfortunatelly I couldn't find something satisfying yet.
I want the routing algorithm to ignore a street segmet, because its flooded or broken. Is that possible (maybe by putting geopoints into the GHRequest)? If it is, what is the best practice for the implementation?
update:
Do i need to create a custom Weighting and set the forbiddenEdges which i get out of OpenStreetMap.org?
Thanks for answers

Yes, a custom Weighting is currently necessary where you feed GraphHopper edgeIDs (!= OSM IDs). Get these edgeIDs via LocationIndex.findClosest.
Please create an issue if you want to have this via web API.

Related

How to access OpenStreetMaps tag (maxspeed) in OSRM query?

I want to access the original maxspeed tag of the OSM edges when using a OSRM query (e.g., routing service with annotations=true).
It seems that OSRM does not provide by default a way to access the original tags of OSM when querying.
After some google-fu it seems that this may be possible with a custom lua profile, but I'm not sure.
Having said that, is there any way to get the maxspeed tag information in a OSRM query?
No we don't preserve the original maxspeed information. A common way to expose this information is to use some external data source to annotate the route after the fact.
OSRM exposes the OSM IDs of all nodes travel if you pass annotations=nodes option. The nodes will be in the .routes[].legs[].annotations.nodes property. You could combine this with a tool like the route-annotator, seems like they are currently working on exposing this information easily.

Live Map Directions while traveling

I'd like to create a route from point A to B.
I'd like to show the current position of the traveler on that route line.
If the traveler deviates from the route I'd like to update the route to compensate realtime.
Basically what Google maps does but I'd like this in my own application.
I looked at Google and Bing Maps API and nothing seems very intuitive.
Whats the best way of doing this?
Logic:
Depending on what you're trying to achieve and most importantly, how you plan to implement those features, you might consider doing it in two steps.
1/ Generate a basic route and create a buffer around
To generate it, use the platform of your choice and retrieve the geometry that you will be able to use to generate
2 / Detect if it get out of the original buffer and generate a new route and go back to step 1
Once you get the buffer, your regularly (based on your location events for example) check the intersection with the buffered route, if it's out of the buffer, then you recreate the route and so on.
Implementation:
In order to do this, you might be interested in using Turf library, see this example:
http://turfjs.org/examples/turf-buffer/
Combined to Within() method:
http://turfjs.org/examples/turf-within/
Turf is available here:
http://turfjs.org/
Consideration
Be careful though regarding the terms of use of each platforms as you might not do driving/navigation application depending on the cases and platforms you want to implement.
You might be able to implement it quite easily, there might be something you can add to optimize accuracy (like bearing to the next geometry location, speed profile...), but I'm sure it will cover at least 90% of your needs based on the described case.

Google Map API v3 Geocoding: should I use full address or just part of it?

When geocoding human readable address into lat lng e.g. 3 mystreetname, myarea, mycity, mypostcode.
Should I use full address or just some part of it, for instance post code?
I know that it works ether way, but I'd like to know what would be the best practice to avoid errors geocoding locations.
Some cities span multiple postal codes, and some postal codes span multiple cities. You might not have problems with smaller data sets but as you start dealing with a lot of addresses things like that can pop up. It's entirely possible that there are two 201 Main Streets in the same zip code, located in two different cities.
So yep, give as much detail as you can.
I'd really recommend storing your information in a spatial datatype if your database supports that as well.
This link is the google's documentation of geocoding
https://developers.google.com/maps/documentation/geocoding/?csw=1
And refer below link for the real time sample..!
http://gmaps-samples.googlecode.com/svn/trunk/geocoder/singlegeocode.html
And for better results use more information so that you will get accurate answers
Hope it helps
I would try running the queries with as much detail as possible, and if a query fails rerun without the zip, as sometimes the zip causes problems with the google api (especially zips greater then 5 digits).

alternative to Google maps

My client wants some of the functionality of Google maps namely:
- geocoding
- generating maps with points based on postal code or long.lat
- optimal trip mapping
Their issues with Google maps
- cannot control outages
- postal codes are sometimes inaccurate or not updated frequently for Canada/UK
- they have no way to correct inaccurate information
They would prefer to host the mapping application themselves, but will require postal code updates.
Can anyone suggest such a product?
thanks
"cannot control outages - postal codes are sometimes inaccurate or not updated frequently for Canada/UK - they have no way to correct inaccurate information"
Outages
hosting your own mapping is the only way to control this, but you would be very very hard pushed to beat Google Maps / Bing Maps uptime over the last 5 years. Take a look at the following:
OpenStreetMap for the road imagery data, this is open source data very good in the UK (Im not sure about canada) and you can make your own changes and submit them (or just change the data you have downloaded)
Geoserver, Mapnik or MapServer will read openstreetmapdata and create the image tiles needed to create your own maps in whatever style you wish. Depending on if you dont want all countries and all zoom levels these products can create all the tiles you will need in advance, but usually they have to be created in real time and cached. You need a BIG fast server to manage tile crunching
Openlayers or Leaflet are open source javascript mapping platforms that will display your tiles for you
Obviously this is just for road maps, aerial imagery would cost you an absolute fortune.
Post Code Data
Many people do not realize that UK postcode data for latitude and longitude is now completely free and available to download every quarter from the official source (ordinance survey) http://www.ordnancesurvey.co.uk/oswebsite/products/code-point-open/index.html.
This is the same data source Google will use and there is none better but it will always contain inaccuracies and always be a few months out of date.
Finally
Hopefully that answer the question you asked and gives you information to inform your client. Now for the question you didn't ask "Is this approach good value to my client?".
I won't presume to know your business or client, however what I described above is possible but with one to many months of work involved to get it all working together and even then it wont have any where near the performance or uptime of something like google /bing maps and only offers a small subset of their features.
I think you're looking for something like Caliper-It's a very custom, and I would expect expensive, solution. Not suggested.
http://www.caliper.com/GISMappingSoftwareDevelopment.htm
One solution could be to use two different mapping services and compare their results, this way there's a much better chance the data is accurate. You can also fix inaccurate data by creating a system which acts as a barrier between the API and your user, where data you know is inaccurate is corrected before it's displayed. Not sure exactly what you're doing though, so this might not work for you.
Is trip mapping/routing the basic functionality you want to do?
Before rushing into rolling your own, I'd suggest a good think about the consequences of doing so. The first that springs to mind is whilst the pros are that you can now control your data, the cons are that you now control your data.
So you are going to have to consider where and when you get updates and the processes you are going to have to employ to keep your maps in sync with the rest of the world. There are a lot of headaches involved in these things which is why so many people use externally hosted solutions such as Googles.

Mechanical Turk: Using HTML in the API

Question for anyone who's used Mechanical Turk: Is it possible to take an HTML template created on Mechanical Turk's website, and then create more HITs based on that template from the command line tools or API?
According to the API docs, it's not possible to create new HTML and add it...from the API. However, what I want to do here is use a HIT template I already created. It would seem like there should be a way to use that template (and load up new data in the API), since Amazon already approved it and I'm using it for HITs already. But I haven't seen a way in the documentation to do so.
The main reason I want the HTML is so I can apply styles that I can't apply by using a questions file. If there was some sort of "rich" question file, that might solve the problem.
You could post a job on Mechanical Turk to have a person take your template and insert your data into it for each HIT you want to create.
(yes, this is at least half sarcasm)
I know this is an old question, but the API has been updated to allow this using HITLayout: http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/ApiReference_HITLayoutArticle.html.
As far as I know, I haven't seen a way to use manually created questions from the API.
If you're planning on doing programmatic access, it may be easier to use the API in its entirety (i.e., specify your questions via XML and create HITs from that question):
http://www.codeplex.com/MTurkDotNet (.NET SDK)
The API is pretty easy to use, and there several code samples.
Alternatively, you can use the "External Question" question type which may be better suited -- you can host the entire question form yourself.