How to find a closest street - google-maps

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.

Related

Geolocation: How to get a uniqueID for a street/block?

Background I'm a bit new to google maps/mapping sdks in general. I want to create a street by street "heat" map of an area on iOS. As an easy to understand example, let's say it will be for the purpose of mapping daily puppy sightings in a city. The data changes regularly, we need to show that certain streets have more puppy traffic than others.
Similar to the ones pictured here
https://blog.mapbox.com/spotangels-mobile-parking-maps-30db4b10aee7
And here
https://www.trulia.com/local/san-francisco-ca/type:traffic_volume_live
To do this, I would like to get a unique ID for each street block.
Something like this:
Question: How can I tell when a user entered a unique street? How can I get a unique street ID?
Related side question: If it's not possible in google maps, links to doing it in OpenStreetMap or Mapbox would be appreciated.
Places I've looked
How to get an use an unique identifier for each street in google maps api
Issue: No answer
Highlighting whole street with some maps API
Issue: Info from 2010
Google Maps: Get coordinates of a street block
Issue: No answer
Get street graph for a game using Google Maps API
Issue: Info from 2012
Map Highlight Odd/Even Side of Street
Issue: Unanswered
Display traffic data with maps
Issue: Unanswered
How to get only street/road coordinates via reverse geocoding (Google Maps API)
Streets in a radius
How to get all roads around a given location in OpenStreetMap?
Partial solution OSM
This should be doable with OSM data.
Retrieve the streets around you (e.g. using Overpass API and the around query). Determine the way you are currently driving on, then split it at each intersection node. Now you have street segments similar to your second image. The start and end node ID of each segment could be used as (temporary¹) identifier.
¹ temporary, because IDs in OSM can change eventually.

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 request polygons from Google Maps?

I am interested in an analogue of http://wiki.openstreetmap.org/wiki/Nominatim
I.e. to be able to make request and get some kind of polygon coordinates:
"geojson":{"type":"Polygon","coordinates":[[[-87.464761,44.600998],[-87.459755,44.599569],[-87.459745,44.601012],[-87.463143,44.601],[-87.464761,44.600998]]]}
Nominatim is good, but it lacks of some data (I am interested in data about cities and counties of Canada). For example, Google Map knows about the Ontario districts and highlights them, but OpenStreetMap - does not. As well as for some cities - where OpenStreetMap shows a dot, Google Maps shows full polygon.
Can it be done with Google Maps?
Other alternatives will work as well.
Yes, it can be done via GMaps API: https://gis.stackexchange.com/questions/43292/how-to-geocode-an-address-to-a-polygon
But be also aware of the legal restriction of the API and the commercial dataset, esp. if you want to use it regularly or for bulk processing: http://www.google.com/help/legalnotices_maps.html
I would also consider to help OSM to improve the dataset. This can be done by contacting the local community and offering help to ask for official public datasources. Esp. in the case of political boundaries, there is no way to get this material on the ground: http://wiki.openstreetmap.org/wiki/Canada

Get type of terrain by coordinate

I'm looking for a solution to be able determine landscape type by a given coordinate, for example check if current position is water/forest/town/road and so on. I found google.maps.MapTypeStyleElementType object specification in the Google Maps specification, but not sure if it could help me or not.
Probably, there are some another Maps API with such functioality? Or maybe I should refer to the different types of offline maps?
Nope, the link you send is just for styling the proper features, not to tell which feature is at a given coordinate. If you are interested in landscape, then Corine Land Cover is the thing you are looking for. It describes the types of biotops like forest, water, but also land use - meadow, field, buildings etc. However, I don't know if there is such an online service where you could query particular coordinates. Other solution for you would be to import these GIS layers (they are freely available) to your own gis map server. Maybe this is partially solved as there are e.g. projects how to incorporate these into openstreetmap.
Well not quite, but you could get close to what you're looking for by using the Google Reverse Geocoder and the Google Places API
Google Reverse Geocoding
http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding
If you send the service a geocode it will send back an address type and/or one of several adress components http://code.google.com/apis/maps/documentation/geocoding/#Types
Google Places API
http://code.google.com/apis/maps/documentation/places/
You could use the Google places API to search for for what's near. If the geocode is in the middle of the lake, the Places API may return something like "Lake Michigan" and then you'd know the terrain obviously.

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