I would like to create an commercial Android GPS app that allows to route a way depending on a speed limit and a vehicle restrictions such us its height and width. I picked GraphHooper as a routing engine and because it does not provide informations about the vehicle's size, I want to add some of the Truck QA Map tags (http://maxheight.bplaced.net/overpass/map.html) and apply it to the GraphHooper's algorithm.
The problem is that GraphHooper is written in Java and from what I see on the GitHub (https://github.com/mmd-osm/osm-maxheight-map), QA Map is based on javascript, php and css.
My question is, is it possible to apply javascript, php and css code to the android project? At this moment I'm considering different solutions and I wonder if it could be done in general. If yes, how it can be done?
There seems to be a misunderstanding.
GraphHopper is a routing engine which is able to process OSM data. Likewise the OSM Truck QA Map is just using OSM data, too (especially the maxheight tag, the OSM wiki has more information about this map).
If GraphHopper doesn't support the maxheight tag yet then all you have to do is add it to GraphHopper. There is absolutely no need to extract it from the QA map because it is already contained in the data used by GraphHopper. You just need to tell GraphHopper to additionally check this tag when calculating its route the same way it already checks lots of other routing tags (like maxspeed, access and so on).
The main purpose of the OSM Truck QA Map is to help you spot any missing maxheight tags in the OpenStreetMap data or visualize already existing tags for trucks, such as maxheight, maxweight, etc. All the data comes in fact from the fabulous Overpass API, so there's not much point trying to extract the data form OSM Truck QA Map. It is really just a visualization tool and works completely in your browser.
Assuming you already have a OSM planet or some smaller extract available for testing, all those maxheight, maxweight, ... tags already exist in that data. You just need to include them in GraphHopper processing (see Scai's reply).
... and if some of the routing results look odd, you might want to check back on OSM Truck QA Map what the actual tagging looks like in the OSM data - or even check what it looked like some time back in the past.
Related
I'm looking for a solution to get data to create a simple roads-only map.
Within a small area specified by lat/long I need data that allows me to draw custom lines between given street coordinates (start and endpoints are basically enough and only from major streets). Coordinates from intersections are also fine to connect those with my custom lines.
Another approaches would be to get all the major street names within the specified area via reverse geocoding and then - somehow - get coordinates for each of this streets.
There was a similar request a couple years ago:
Get street graph for a game using Google Maps API and I'm wondering is it still a big deal to achieve this kind of technical information in a simple way?
EDIT:
I researched the topic but no result gave me the satisfaction I was looking for. For instance Google's Directions/Roads API are both depending on routes. OSM/Google Maps API are filled with information around a specified geo location but without any technical data I need. To be simple: An Array of intersection/street-point coordinates (are they even called coordinates?!).
I think I'm lost - or even stuck - in terms of my own search phrases. I'm not looking for a copy & paste snippet more like a direction or some hints where to focus next or how it is done.
With the clarification of geocodezip's comment I've found the following related question:
How to get all roads around a given location in OpenStreetMap?
This fully suits my demand to get specific road information within a certain location using OSM instead of Google Maps API.
Many thanks
I am working on a quote calculator that will generate a quote based on mileage between various locations (amongst other conditionals). Up until two days ago, I had planned to use Google's Distance Matrix service until I discovered:
Display of a Google Map
Use of the Distance Matrix service must relate to the display of information on a Google Map; for example, to determine origin-destination pairs that fall within a specific driving time from one another, before requesting and displaying those destinations on a map. Use of the service in an application that doesn't display a Google map is prohibited.
I had hoped to use only the services that I require:
- Distance by Road Measurement between up to three different locations
- Address Autocomplete Service usable on an input box
- Accurate, reliable service that can provide multiple different routes to create an average distance
I know there are other methods available for this, but I doubt many can be as accurate and reliable as Google, I've found it challenging to find anything comparable to Google Maps for the purposes I require.
So, unless you guys can point me to something that I can use, my only option is to use a Google Map where I don't need it, adding additional loading time and altering the UX design I had planned.
Are there any free services available for what I require (preferably with a JS API)?
On a slightly different note
If I do use a Google map, would it have to be displayed immediately, or could I hide it and add an option to 'Show On Map', and have it .slideToggle revealed?
Unfortunately for the Distance Matrix API, Google strictly says you NEED to display the map in your application:
Use of the Distance Matrix API must relate to the display of information on a Google Map; for example, to determine origin-destination pairs that fall within a specific driving time from one another, before requesting and displaying those destinations on a map. Use of the service in an application that doesn't display a Google map is prohibited.
http://developers.google.com/maps/documentation/distancematrix/#Limits
However, what I think is more useful for your need is Google Directions API. The directions API allows you to cover your requirements.
The total distance is returned in the JSON object from the request.
You can select upto as many different locations to find distances between using the Waypoints in your search request. The distances between these locations are then returned in each "leg".
You can obtain the average distance from multiple different routes to your destination by specifying the alternatives parameter in your search request to true. See: http://developers.google.com/maps/documentation/directions/#RequestParameters
Best of all, there is no requirement from Google to display the Google Map in your application when using this service.
I should also mention the drawbacks to this service, if you choose to use it.
The request time it takes to process your request will be slightly longer than if you were to use the Distance Matrix API.
You'll have a lot of unneeded data in the return object, for instance the individual "steps" of the route in the returned json object is not necessary based on your application requirements.
Given the drawbacks, I'd still highly recommend looking into the Directions API for your application.
I don't know if Google Static Maps count as a map, but it should, since it's a Map and from Google.
You could calculate the route and then show it as an image from Static Maps. No extra map loading times required. Only one image.
https://developers.google.com/maps/documentation/staticmaps/#Paths
Many developers have been able to do this with the Bing Maps REST routing service http://msdn.microsoft.com/en-us/library/ff701705.aspx. It requires a bit more development but works well. Here is an example: http://code.msdn.microsoft.com/Bing-Maps-trip-optimizer-c4e037f7
Streetmap and arcserver can solve a vehicle routing problem but it's not free. Read more here: http://www.esri.com/data/streetmap.
I am looking for examlpes of how to use polylines in V3 of Google maps, I have read the help at Google but must admit I don't fully understand. I feel if I could see a good example I might understand it better. What I have is a site that I track my vehicle I have it plotting the points on the map what I want is to draw the line between the points. I am using a mysql database and a XML file with PHP to display the point on the map.
Any help would make my day. I have found this site very helpful and I wish to thank all.
Take care, all the best
It's a matter of creating a KML xml file, using data from your database, and feed google api with that. You can use this tool to interactively see how the kml file changes while adding points to the polyline.
EDIT:
Create a script in your preferred scripting language which retrieves the points from database, and generates a kml file format as in the third link above.
In your javascript script, you need to add a kml layer to the map, loading the kml you generate on the fly in your script at point 1. :
[...]
var map = new google.maps.Map(document.getElementById('map'), options);
[...]
kmlFiles = new google.maps.KmlLayer("http://yourdomain.com/generatekml.php");
kmlFiles.setMap(map);
and that's it.
I'm looking into some options for a mapping project (web, probably HTML5 Canvas based). Ideally, we are creating a navigational map (i.e. Google Maps) that would have our own very simple imagery (not satellite), but we are looking into ways of getting state / city lines, and maybe other important features. Does anyone know of a good database or project that contains this data correlated to longitude and latitude? Or are we looking at potentially drawing these lines ourselves?
There is a huge amount of choice available, but it really does depend on exactly what your looking for, what level of detail and which countries.
One of the first places you'll want to look is open geo:
http://opengeo.org/
These guys have links to all the open source geographic stuff that's available more or less.
second to that is the OS-Geo consortium:
http://www.osgeo.org/
Again these guys maintain pre-made kits and links to the majority of data & applications available.
Once you go beyond here, then you likely will need to start looking at country organisations like the USGS:
http://www.usgs.gov/pubprod/
and
http://egsc.usgs.gov/isb/pubs/factsheets/worldmaps.html
you'll most likely also want to take a look at some of the country specific data sets available such as the UK's ordnance survey:
http://www.ordnancesurvey.co.uk/oswebsite/products/os-opendata.html
and the USA Tiger data sets:
http://www.census.gov/geo/www/tiger/
finally, you could take a look at the likes of "Open street map" (And other similar products)
http://www.openstreetmap.org/
Open street map originally set out to cover the UK, but seems to be going at least Europe wide now (Maybe even world wide)
This is all I can remember off the top of my head at the moment, but one other tip I'll give, sites belonging to the top GIS software providers such as ARC-GIS & Mapinfo all have lists of mapping data providers on their websites, and some even have free data available too, an afternoons browsing should uncover you a lot of sources.
http://openstreetmap.org should have what you need.
I'm trying to do some network analysis for a client. The provided road-network GIS layer is of bad quality; therefore, I have to resort to Google maps to provide me shortest path between 200 points, to produce time and distance matrices between each point.
is there a way i can input the layer as a set of KML points to obtain outputs of the distance and time between these points ?
if this is doable via the api, do you have any hints or suggestions on how to write such a script?
EDIT
the ideal final result would be a CSV file of the following form:
node_1, node_2, distance, travel_time
node_n, node_m, distance, travel_time
I won't write the whole script for you, but this can be done with the maps API. Open up the maps sandbox and add to the onGDirectionsLoad function:
alert(gdir.getDistance().meters);
You can find the documentation here - a getDuration() is also available. Then all you need to do is issue a new request once one finished, getting directions for each pair of start and end point.
However, note that if you're planning on getting 200*200 paths, google may decide to rate limit you at some point. Use this method at your own risk, and with a delay between requests.
Note also that google's builtin KML support doesn't seem to support giving you the list of points - this makes sense, since the client may only have those that are currently onscreen. You might need to write your own KML loader if you want to use KML as the input format. Or use a simpler format, as in this example.