2

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 enter image description here https://blog.mapbox.com/spotangels-mobile-parking-maps-30db4b10aee7

And here enter image description 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: enter image description here

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

Emin Israfil iOS
  • 1,801
  • 1
  • 17
  • 26
  • 1
    Are you looking for something like [this](https://www.smithsonianmag.com/science-nature/plan-replace-geographic-coordinates-earth-unique-strings-three-words-180949946/)? – geocodezip Mar 16 '18 at 01:56
  • Isn't lat & lon already a good unique "ID" for a street or block? @geocodezip I really hope he is *not* looking for such a proprietary system. – scai Mar 16 '18 at 10:28
  • OSM does *not* have [permanend IDs](https://wiki.openstreetmap.org/wiki/Permanent_ID). However it is possible to construct something similar using [Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API/Permanent_ID). Not sure how good (i..e how permanent) this solution will be, though. – scai Mar 16 '18 at 11:03
  • The question is really broad, trying to get the OP to clarify. – geocodezip Mar 16 '18 at 13:00
  • @geocodezip Sorry about the lack of clarity. Nope, I'm not referring to lat/longs. I was wondering if I can somehow get an id for the street or somehow tell when a user entered a new block on the same street. I added a photo to hopefully clear things up a bit. – Emin Israfil iOS Mar 16 '18 at 23:04
  • Have you tried looking at the [nearestRoads endpoint of the Roads API](https://developers.google.com/maps/documentation/roads/nearest) – Preston Mar 17 '18 at 00:29

1 Answers1

1

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.

scai
  • 20,297
  • 4
  • 56
  • 72