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

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.

Related

How google get polygon data for locality in a city

I have seen google showing polygon lines for locality in a map. eg: https://www.google.co.in/maps/place/Koramangala,+Bengaluru,+Karnataka/#12.9354922,77.6146828,14z/data=!3m1!4b1!4m5!3m4!1s0x3bae144ed898fc2d:0x1681f38e8c00ae56!8m2!3d12.9279232!4d77.6271078
I wanted to know how google gets this data. Do they use any kind of mapping of images to the government data available in the countries in the world. I dont think all the countries provide data (lats, longs) at such granular level.
Right now this feature is unavailable for Google Maps API. But there is a feature request on Google's Issue Tracker that you can star and comment on.
Here's the link:
https://issuetracker.google.com/35816953
There are workarounds for this though where you get the data elsewhere and draw the polygons yourself.
Here's the link to that:
Google Maps how to Show city or an Area outline

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.

maps windows phone 8

I am trying to make an application for windows phone 8 that could track current location of user and gives a route from current location to desired destination location.
With existing maps feature (bing, Nokia maps) it is not possible to track the location areas for Karachi Pakistan by their respective names. For example, if I want to get the route from pizza hut, Karachi to dolmen mall, Karachi, it will never show a route since the areas are not marked in the map.
This problem doesn't occur for people living in the US I suppose, since I saw many tutorials where exact locations are shown by just typing in the area names in the search bar (as for Redmond and Chicago). What should we, the users of elsewhere do.... while if we see Google maps, all areas even of Karachi, Pakistan are marked.
please help.
In Bing Maps, if you have two coordinates that are on roads that are drawn on Bing Maps you can get a route between them anywhere in the world. WP8 uses just Nokia data which is only one of several data providers used by Bing Maps. You can use the Bing Maps REST services to route between any two coordinates that are on roads in the world, including Pakistan. Here is some information about the Bing Maps REST routing service:
http://msdn.microsoft.com/en-us/library/ff701705.aspx
http://msdn.microsoft.com/en-us/library/jj819168.aspx
http://msdn.microsoft.com/en-us/library/jj870778.aspx
Bing Maps are very powerful and easy to implement but unfortunately they are not supported in Pakistan. Due to restriction you are not able to find route between two geo location point or places. But Microsoft promised to give its support in Pakistan very soon as they are working on it as well.
The link given below will show you the restriction of bing maps in different regions.
http://msdn.microsoft.com/en-us/library/jj670541.aspx
I have written a blog post in which I have drawn a route between two location points but it will not work for you as I already told you.
http://dev-bingmaps.blogspot.com/
Now there is one solution in from which you can find route that is to use google maps.

Highlight street on any of type of maps

The problem I have is that I would like to highlight the whole street from beginning to the end. For example if I enter Av. Montaigne, Paris, France in Google Maps, I want the whole street to be highlighted.
It seems that Google Maps does not support this option and I would have to implement algorithm to mark the street by using polylines. However, I am not sure if there is a somewhat easy way to get information about how the street looks like, because the street could be curved so it is a problem.
Is it possible to get information that would be simple to use to highlight the street from beginning to end by just passing street name to API? The maps that I would use do not have to be Google maps, they can be Yahoo, Bing on OpenStreetMap.
The goal is actually something like this:
As far as I know, none of the common web map APIs offer this facility. Two possible approaches come to mind, although neither one is straightforward or reliable:
a.) Download from OpenStreetMap a local set of all the road data that you want to be able to highlight in your application. Then, when your user enters the street name they are searching for, search the OSM data and construct a polyline from the relevant coordinate points and plot it on the map. The problem with this approach is that it requires you to host and maintain a complete set of road data, and also implement the appropriate parsing algorithm to deal with misspellings of street names etc. You may often find that road names as they appear on Google Maps will be spelled differently than they are in OSM, for example.
b.) Use a routing service to calculate a route from one end of the street to the other, and then plot a polyline that follows the points of the route. e.g. Using the Bing Maps Routes API (http://msdn.microsoft.com/en-us/library/ff701717.aspx), you could plot a route between the two intersections at either end of the road in question - e.g. "Av. Montaigne & Rond-point des Champs-Élysées" to "Av. Montaigne & Place de L'Alma". You could then plot a polyline from the route points as follows:
There are two problems with this approach: first, you need to know the names of the roads with which the street intersects at either end (or some other way of identifying the ends of the street in question), and secondly, the route chosen between those two intersections may not actually follow the street itself (for example, if the street is one-way and you try to calculate a route in the other direction).

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.