4

I need to get the highway name on which the user is currently navigating. That can be done in navigation mode, getting it from

-(void)routingService:(SKRoutingService *)routingService didChangeCurrentStreetName:(NSString *)currentStreetName streetType:(SKStreetType)streetType countryCode:(NSString *)countryCode

So, when I was testing my app yesterday, I was on the highway, and yes, Skobbler did recognised that I am on one, and yes, I got the Highway name back.

It was "Brooklyn-Queens Expressway". But, Brooklyn-Queens Expressway is actually name of the I-278 Interstate highway, and all the functions I would later have to use, need to get Highway name in that format I-nnn

Here is the map photo of what I mean

enter image description here

So, Is there a way to get streetName in that I-nnn format, when the streetType is recognised as an interstate highway? Or is there any Open Streetmap database we could consult? I wasn't able to find anything on OSM Wiki.

SteBra
  • 4,071
  • 5
  • 36
  • 66

2 Answers2

3

Don't know about the Skobbler SDK, but if online query is available and you have the approximate geographical area and the name of the motorway, you may use the Overpass API (http://wiki.openstreetmap.org/wiki/Overpass_API) to query the openstreetmap database for the highway reference.

For example, the following query (for a particular bbox which contains a small section of the highway):

[out:json]
[timeout:25]
;
(
  way
    ["highway"="motorway"]
    ["name"="Brooklyn-Queens Expressway"]
    (40.73483602685421,-73.91463160514832,40.73785205632046,-73.9096748828888);
);
out body qt;

returns (with some key-value pairs omitted for simplicity):

{
  "version": 0.6,
  "generator": "Overpass API",
  "osm3s": {
    "timestamp_osm_base": "2015-09-18T20:21:02Z",
    "copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
  },
  "elements": [

{
  "type": "way",
  "id": 46723482,
  "nodes": [
    488264429,
    488264444,
    488264461,
    488264512,
    488264530,
    488264541,
    597315979
  ],
  "tags": {
    "bicycle": "no",
    "bridge": "yes",
    "foot": "no",
    "hgv": "designated",
    "highway": "motorway",
    "horse": "no",
    "lanes": "3",
    "layer": "1",
    "name": "Brooklyn-Queens Expressway",
    "oneway": "yes",
    "ref": "I 278",
    "sidewalk": "none",
  }
},
{
  "type": "way",
  "id": 46724225,
  "nodes": [
    597315978,
    488242888,
    488248526,
    488248544,
    488248607
  ],
  "tags": {
    "bicycle": "no",
    "bridge": "yes",
    "foot": "no",
    "hgv": "designated",
    "highway": "motorway",
    "horse": "no",
    "lanes": "3",
    "layer": "1",
    "name": "Brooklyn-Queens Expressway",
    "oneway": "yes",
    "ref": "I 278",
    "sidewalk": "none",
  }
}

  ]
}

Which are 2 sections of the road in the osm database. In the US the "ref" tag for interstates is in the form "I XXX" (See http://wiki.openstreetmap.org/wiki/Interstate_Highways and note the format for co-location). You can retrieve the interstate name accordingly.

You can try the above query in overpass-turbo (a UI for the service) at http://overpass-turbo.eu/s/bxi (Press RUN and the DATA tab for the returned data, and pan the map for query in another bbox).

headuck
  • 2,673
  • 14
  • 19
1

The "ref" information is not exposed in the SDK (will put this on the TODO list).

A workaround would be to look in the text advices (when using TTS) as this information is there (if you look at the $ref parameter, that contains the information you are looking for). For more details regarding the text advices structure, see this blog article.

Ando
  • 10,317
  • 2
  • 27
  • 44