A* algorithm with google maps API - google-maps

I want to implement an A* Search Algorithm with google maps's API, but how can I get the coordinates just from the streets, not from the houses etc? And how can I get the neighbor's coordinates from this specific street coordinate? How can I identify crossroads? Does someone have an idea? I need this to trace a route, but I don't want to use google's algorithm
*Coordinates= Latitude,Longitude

The street data is not available via the Google Maps API for use in other routing algorithms read the terms of service). You will need to use an open source for mapping data like Open Street Maps

Related

Street and Road names in Google Map

I would like to retrieve all the road and street names, if i enters a area in search box. Is that possible in Google API ?
I have checked List of all street and road names in Google in API for solution, but there it is been given for auto complete box and the request is not for my requirement.
Also I learnt that Open Street Maps provide us these data, unfortunately I would like to perform some operations based upon the Google API's. So can you suggest me a way, otherthan OSM.
Google Maps API does not provide such functionality. However, there is a Google Maps Roads API which is one of their premium paid APIs which lets you query nearest road names and other road metadata. You can check that out here:
https://developers.google.com/maps/documentation/roads/intro
You can also try Overpass-Turbo (https://overpass-turbo.eu/) which lets you query OSM data. You can set the bounds and the OSM tags you are interested in.

Open Street Maps or Google API for extracting all house locations in a City?

I am working on mapping a city like represented in the real world. So how do I map the exact locations of houses and other key buildings ?. Should I work with reverse Geocoding provided by Google or extract and manipulate raw information from OSM.
You can't to that with the google maps geocoding API, without violating the terms of use, ragarding to chapter 10.5 Intellectual Property Restrictions, paragraph (c) and (e). This solution is very accurate but sadly there is no way to use it outside a google maps app.
The second way is to do it with OpenStreetMap. But be carefull ! OSM is a volunteered geographic map/database, with no guarantee for complete data. In a famous city there will be no problem! But if you want to get the houses in a little hamalayan village you will find no houses/data. But the simplest approach to get OSM data you may take use of the overpass API. You also can use the overpass API via the userinterface overpass turbo. Overpass turbo should be the approach of your choice, because there you are able to beck for existing houses/data parallel on a map.
With this snippet you get all buildings inside a polygon:
way(poly:"50.7 7.1 50.7 7.2 50.75 7.15")["building"];
(._;>;);
out body;

How to find a closest street

I'm reading through Google Maps API documentation and I wonder if such a think is possible:
I specify the point (by coords)
I search for all roads, and junctions around the node (say in 1km radius)
I get parameters for the streets around (polyline coords)
Is it reachable, or google do not share that data?
Thanks in advance
Rafal
I can image writing up a little script that generates a bunch of random points within a 1km radius and then performs directions services via Google Maps API to obtain all possible routes and thus streets within a 1km radius. However, this is problematic since it is kinda against the Google Maps TOS of displaying this information only on a map within a website and not extracting data for you personal use as this would be.
A better approach would be looking into utilizing Open Street Map data where you can download street data from a specific viewport. If buying street network data is an option, you can go to a commercial outlet such as NAVTEQ or PTV which post-processes NAVTEQ data to a format for use in the transport modeling software package you mention on your blog.

How to handle inaccurate Google Maps locations?

When I type in addresses in Google maps for locations in Asia, quite a lot of them are off by more than 200 metres. For example, "blk 85 bedok north road, singapore" is off by more than 300 metres. While I don't expect Google Maps to be spot on every time, sometimes the error is too great for certain use cases. What options do I have to handle inaccurate Google Maps locations in a web app? The web app should let the user enter an address or postal code as part of an entry and I will geocode the address and store the lat-long.
You could use bing, yahoo's and google's Geo Location api's to find latitude and longitude for a location, average the results together and use the result. Thus, if they all agree, you still get a good location, but if they disagree you get the best approximation of all three.
You could even programmatically compare the results from each engine and throw out any that don't agree with the others (for instance, if bing and yahoo agree and google does not, you could throw out google).
Beyond that, if you have a collection of addresses you know to be wrong, you could simply store the correct longitude and latitude for those points, and override the results in those cases.
Of course, to get around this problem at all, you'll need to geocode the addresses, check their validity in some way (as described above), and plot them using their latitude and longitude.
You don't have any fixes for this really, you're at the mercy of the accuracy of google maps here. The important part is you don't know if the address in inaccurate when doing one search to the next, so nothing you can do to handle it.
You can post a topic here and google will see it and often respond as well: Google Maps Local Listing Forums. I'd open something there with some of your examples and hope they get more accurate...that's all you can do in this case.
There are always other alternatives as well, yahoo and bing have mapping APIs, but I have no idea how much better or worse off you'd be going that route.
The problem is not the lat/lng data, in fact, they are correct. The problem is that the geo coords of the map tiles of the public Google maps api are inaccurate. The maps at maps.google.com are provided by a different map provider than the map tiles used with the public Google Maps API that you can embed in your website, use in your own applications, etc.
Check my recent posting at Google Maps & apps with mapview have different current positions
Is the result out on maps.google.com as well as through the maps api?
If on google maps live site the result is accurate then you can do an ajax search to return the correct lon/lat.
I have used this when geocoding UK postcodes
Geocoding UK Postcodes with Google Map API
I tried to reply to the upper answer, but I am not qualified enough yet. Just be aware that whatever you're using for geocoding, sometimes has restrictions on the use of that data. For example, google's geocoding API isn't allowed to be used to display information retrieved anywhere but google maps. The same might be for the others, I don't know what your project is, but it's something to be aware of.

Topographical or relief data in Map APIs

I was wondering if anyone knew of any map APIs that offer topographical or relief data? I've had a quick look at Google and Bing APIs, but could find nothing there.
Google allow you to view a map as TERRAIN, which means you can see the topography of a map, but I want to be able to get at that data - i.e. if I were to draw a line between 2 points on Google Maps, I want to know how high above see level points along that line are.
Is this possible with any map APIs out there?
Thanks for your time!
Here's a simple example of height along a route.
I use USGS to obtain the elevation data, Google Maps API to plot the route and Google Charts to draw the elevation profile.
Full details in the associated tutorial.
Here are a few web services that provide elevation data:
USGS Elevation Query Web Service
EarthTools
GeoNames
Also, this site can search each of them