Avoid a given road using direction APIs - google-maps

I'm currently developing a tool for motorized bicycles based in Paris, France.
My issue is that in some cases, the APIs that I have tested will return that I have to use a road that can't be used by motorcycles (the "Boulevard Périphérique", can't be used by 50 cc engine motorcycles). In all of the APIs that I have used, the only filters available are cars, bikes and pedestrians. I also tried filtering out highways, but the road I'm talking is not considered as a highway.
Does anyone knows if there is an existing API that allows me to do such a thing ?
Thank you for your replies

Assuming you have the engine size limitation data in hand, you can use mustAvoidLinkIds, tryAvoidLinkIds, or routeControlPoint in the MapQuest directions api to avoid those roads.

Related

How do I get vertice data from google/bing maps?

I'm trying to develop a application that uses informations from google/bing maps, but I need the vertice data to recreate roads and I can't use images since I can't get road names and height info.
I need vertices/nodes of streets (with latitude,longitude,altitude, street name ) and no visual data.
Thanks.
Open Street Map is definitely the way to go for this - extracting vertex information from Bing/Google is both technically difficult, and a breach of the Terms of Use. OSM data is better quality in many cases and, more to the point, free to use under a CC-BY-SA licence.
You'll also probably need a spatial database in which to store the information. I've written a couple of articles about loading OSM data into SQL Server which you might find helpful. e.g.:
http://alastaira.wordpress.com/2011/04/15/loading-open-street-map-data-in-sql-server-part-ii-ways/

Draw an area on google map and get a list of all cities covered by that area

Is there any such functionality provided by google maps API, such that I draw a random area on google map and then through some functions in the API, receive a list of all cities and sectors that were covered under that drawn area ?
Any information or help is greatly appreciated.
No, that functionality does not exist (as far as I know, anyway). You can try to fake it by selecting a sufficient number of points in your polygon and reverse geocode them, but obviously that is an imperfect solution in terms of both performance and completeness.
Barring that, there may be resources that you can license for a fee or there may be a resource made available by the government of India that may help you solve this problem. (Or perhaps there is not. I'm speculating.)

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.

Why does the google geocoder give different results from the map search?

For example, searching for "36 High Street Clapham London SW4 7UR" using the geocoder gives a significantly different location from the main map search, rendering the geocoding service useless, for my purposes at least.
Anyone know why this is and if there's a workaround?
One thing to watch out for in UK geocoding is that the Royal Mail owns the copyright to UK postcode geographic information, and has refused to sell Google a licence to redistribute that information. Google has a licence hat allows it to use the information for geocoding on its own websites, but not for other people's websites. That doesn't explain that particular address, but it does affect the geocoding of many UK locations.
There was a bug in the API geocoder (maps.google.com geocoding was not affected) a while ago that caused it to get wrong information about the existence of certain house numbers in a street. It's possible that this might be happening again. Note that "34 Clapham High Street, London" geocodes correctly, but the API thinks that 36 doesn't exist, and just returns a location with accuracy=6 (street) instead of accuracy=8 (address). This might possibly be happening again. If you think that's what's happening, find several convincing examples and post them to the discussion group.
Well for one thing there's nothing that says the map search uses the geocoder service. Clearly, it's related, but may not be the same thing.
Also, the main map search is influenced by the current viewport of the map pane. If you're zoomed in one one country or location, the search will be biased by that. if you use the geocoder, you can supply various optional parameters including viewport bias.

Optimal map routing with Google Maps

Is there a way using the Google Maps API to get back an "optimized" route given a set of waypoints (in other words, a "good-enough" solution to the traveling salesman problem), or does it always return the route with the points in the specified order?
There is an option in Google Maps API DirectionsRequest called optimizeWaypoints, which should do what you want. This can only handle up to 8 waypoints, though.
Alternatively, there is an open source (MIT license) library that you can use with the Google Maps API to get an optimal (up to 15 locations) or pretty close to optimal (up to 100 locations) route.
See http://code.google.com/p/google-maps-tsp-solver/
You can see the library in action at www.optimap.net
It always gives them in order.
So I think you'd have to find the distance (or time) between each pair of points, one at a time, then solve the traveling salesman problem yourself. Maybe you could convince Google Maps to add that feature though. I guess what constitutes a "good enough" solution depends on what you're doing and how fast it needs to be.
Google has a ready solution for Travel Salesman Problem. It is OR-Tools (Google's Operations Research tools) that you can find here: https://developers.google.com/optimization/routing/tsp
What you need to do basically is 2 things:
Get the distances between each two points using Google Maps API: https://developers.google.com/maps/documentation/distance-matrix/start
Then you will feed the distances in an array to the OR-Tools and it will find a very-good solution for you (For certain instances with millions of nodes, solutions have been found guaranteed to be within 1% of an optimal tour).
You can also note that:
In addition to finding solutions to the classical Traveling Salesman
Problem, OR-Tools also provides methods for more general types of
TSPs, including the following:
Asymmetric cost problems — The traditional TSP is symmetric: the distance from point A to point B equals the distance from point B to
point A. However, the cost of shipping items from point A to point B
might not equal the cost of shipping them from point B to point A.
OR-Tools can also handle problems that have asymmetric costs.
Prize-collecting TSPs, where benefits accrue from visiting nodes
TSP with time windows
Additional links:
OR-tools at Github: https://github.com/google/or-tools
Get Started: https://developers.google.com/optimization/introduction/get_started
In a typical TSP problem, the assumption is one can travel directly between any two points. For surface roads, this is never the case. When Google calculates a route between two points, it does a heuristic spanning tree optimization, and usually comes up with a fairly close to optimal path.
To calculate a TSP route, one would first have to ask Google to calculate the pair-wise distance between every node in the graph. I think this requires n*(n-1) / 2 calcs. One could then take those distances and perform a TSP optimization on them.
OpenStreetMaps.org has a Java WebStart application which may do what you want. Of course the calculations are being run client side. The project is open source, and may be worth a look.
Are you trying to find an optimal straight line path between locations, or the optimal driving route? If you just want to order the points, if you can get the GPS coordinates, it becomes a very easy problem.
Just found http://gebweb.net/optimap/ It looks nice and easy. Online version using google maps.