CUTR-at-USF / usf-mobullity

USF Maps responsive web application
http://maps.usf.edu/
8 stars 7 forks source link

Mapzen/Pelias Geocoder Labels #337

Closed jmfield2 closed 7 years ago

jmfield2 commented 8 years ago

Currently, MapQuest Nominatum API gives us results with unique labels (including address/street) where Pelias only returns the city. This is a problem currently because the label is used as a key to determine which item was selected.

We can workaround this problem by changing the key to something else (like an index) in our frontend code, or ask mapzen to add the relevant fields to their results.

From a quick glance, it doesn't look like the data exists in OSM - so it may be a proprietary thing from mapquest.

Nominatum: mobullity

Mapzen: mapzen

barbeau commented 8 years ago

@jmfield2 Could you add a JSON response from Mapquest Nominatim here so we have an example of the raw data we were using to populate the auto-fill?

jmfield2 commented 8 years ago

For: http://open.mapquestapi.com/nominatim/v1/search?key=kOgk9LSvIeh3EbKOupBCxC5w4tB2JtF4&q=subway&format=json&viewbox=-83.23,28.32,-81.81,27.63&bounded=1

[
    {
        "place_id": "10994574",
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
        "osm_type": "node",
        "osm_id": "1034234743",
        "boundingbox": [
            "28.1453895",
            "28.1453895",
            "-82.2829558",
            "-82.2829558"
        ],
        "lat": "28.1453895",
        "lon": "-82.2829558",
        "display_name": "Subway, Cross Creek Boulevard, Tampa, Hillsborough County, Florida, 33647, United States of America",
        "class": "amenity",
        "type": "fast_food",
        "importance": 0.101,
        "icon": "http://open.mapquestapi.com/nominatim/v1/images/mapicons/food_fastfood.p.20.png"
    },
    {
        "place_id": "22947888",
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
        "osm_type": "node",
        "osm_id": "2259090672",
        "boundingbox": [
            "27.922235",
            "27.922235",
            "-82.493839",
            "-82.493839"
        ],
        "lat": "27.922235",
        "lon": "-82.493839",
        "display_name": "Subway, South Macdill Avenue, Bay Oaks Apartments, Hyde Park, Tampa, Hillsborough County, Florida, 33608, United States of America",
        "class": "amenity",
        "type": "fast_food",
        "importance": 0.101,
        "icon": "http://open.mapquestapi.com/nominatim/v1/images/mapicons/food_fastfood.p.20.png"
    },
    {
        "place_id": "1512526",
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
        "osm_type": "node",
        "osm_id": "321466877",
        "boundingbox": [
            "27.9504126",
            "27.9504126",
            "-82.4554185",
            "-82.4554185"
        ],
        "lat": "27.9504126",
        "lon": "-82.4554185",
        "display_name": "Subway, East Twiggs Street, Harbour Island, Tampa, Hillsborough County, Florida, 33602, United States of America",
        "class": "amenity",
        "type": "fast_food",
        "importance": 0.101,
        "icon": "http://open.mapquestapi.com/nominatim/v1/images/mapicons/food_fastfood.p.20.png"
    },
    {
        "place_id": "1537063",
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
        "osm_type": "node",
        "osm_id": "321448213",
        "boundingbox": [
            "27.9484653",
            "27.9484653",
            "-82.4586323",
            "-82.4586323"
        ],
        "lat": "27.9484653",
        "lon": "-82.4586323",
        "display_name": "Subway, Madison Street, Harbour Island, Tampa, Hillsborough County, Florida, 33602, United States of America",
        "class": "amenity",
        "type": "fast_food",
        "importance": 0.101,
        "icon": "http://open.mapquestapi.com/nominatim/v1/images/mapicons/food_fastfood.p.20.png"
    },
    {
        "place_id": "4182428",
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
        "osm_type": "node",
        "osm_id": "444550780",
        "boundingbox": [
            "27.9598682",
            "27.9598682",
            "-82.4023296",
            "-82.4023296"
        ],
        "lat": "27.9598682",
        "lon": "-82.4023296",
        "display_name": "Subway, North 50th Street, East Ybor, Tampa, Hillsborough County, Florida, 33605, United States of America",
        "class": "amenity",
        "type": "fast_food",
        "importance": 0.101,
        "icon": "http://open.mapquestapi.com/nominatim/v1/images/mapicons/food_fastfood.p.20.png"
    },
    {
        "place_id": "10996126",
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
        "osm_type": "node",
        "osm_id": "1033910277",
        "boundingbox": [
            "28.1000977",
            "28.1000977",
            "-82.3994584",
            "-82.3994584"
        ],
        "lat": "28.1000977",
        "lon": "-82.3994584",
        "display_name": "Subway, Tampa Palms Boulevard West, Tampa, Hillsborough County, Florida, 33647, United States of America",
        "class": "amenity",
        "type": "fast_food",
        "importance": 0.101,
        "icon": "http://open.mapquestapi.com/nominatim/v1/images/mapicons/food_fastfood.p.20.png"
    },
    {
        "place_id": "4997538",
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
        "osm_type": "node",
        "osm_id": "557417092",
        "boundingbox": [
            "27.828034",
            "27.828034",
            "-82.647673",
            "-82.647673"
        ],
        "lat": "27.828034",
        "lon": "-82.647673",
        "display_name": "Subway, 62nd Avenue North, Fossil Park, St. Petersburg, Pinellas County, Florida, 33702, United States of America",
        "class": "amenity",
        "type": "fast_food",
        "importance": 0.101,
        "icon": "http://open.mapquestapi.com/nominatim/v1/images/mapicons/food_fastfood.p.20.png"
    },
    {
        "place_id": "39018900",
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
        "osm_type": "node",
        "osm_id": "2880271608",
        "boundingbox": [
            "27.713372",
            "27.713372",
            "-82.713884",
            "-82.713884"
        ],
        "lat": "27.713372",
        "lon": "-82.713884",
        "display_name": "Subway, Pinellas Bayway, Isla Del Sol, St. Petersburg, Pinellas County, Florida, 33715, United States of America",
        "class": "amenity",
        "type": "fast_food",
        "importance": 0.101,
        "icon": "http://open.mapquestapi.com/nominatim/v1/images/mapicons/food_fastfood.p.20.png"
    },
    {
        "place_id": "20495155",
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
        "osm_type": "node",
        "osm_id": "2030693738",
        "boundingbox": [
            "27.8033739",
            "27.8033739",
            "-82.6995456",
            "-82.6995456"
        ],
        "lat": "27.8033739",
        "lon": "-82.6995456",
        "display_name": "Subway, 49th Street, Disston Heights, St. Petersburg, Pinellas County, Florida, 33782, United States of America",
        "class": "amenity",
        "type": "fast_food",
        "importance": 0.101,
        "icon": "http://open.mapquestapi.com/nominatim/v1/images/mapicons/food_fastfood.p.20.png"
    },
    {
        "place_id": "20503156",
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
        "osm_type": "node",
        "osm_id": "2030693732",
        "boundingbox": [
            "27.7805262",
            "27.7805262",
            "-82.7006573",
            "-82.7006573"
        ],
        "lat": "27.7805262",
        "lon": "-82.7006573",
        "display_name": "Subway, 9th Avenue North, Central Oak Park, St. Petersburg, Pinellas County, Florida, 33713, United States of America",
        "class": "amenity",
        "type": "fast_food",
        "importance": 0.101,
        "icon": "http://open.mapquestapi.com/nominatim/v1/images/mapicons/food_fastfood.p.20.png"
    }

]
barbeau commented 8 years ago

Here's what I see in a Pelias response, from https://search.mapzen.com/v1/search?api_key=search-hAyPn56&text=subway&sources=osm&focus.point.lat=28.061062&focus.point.lon=-82.413200:

properties: {
id: "node:570760825",
gid: "openstreetmap:venue:node:570760825",
layer: "venue",
source: "openstreetmap",
source_id: "node:570760825",
name: "Subway",
confidence: 0.95,
distance: 0.302,
country: "United States",
country_gid: "whosonfirst:country:85633793",
country_a: "USA",
region: "Florida",
region_gid: "whosonfirst:region:85688651",
region_a: "FL",
county: "Hillsborough County",
county_gid: "whosonfirst:county:102085773",
locality: "Tampa",
locality_gid: "whosonfirst:locality:85931789",
neighbourhood: "Plesant Dale",
neighbourhood_gid: "whosonfirst:neighbourhood:85889751",
label: "Subway, Tampa, FL, USA"
}

I suppose we could concatenate name, neighbourhood, locality, region_a, and country_a to produce our own key, like:

Subway, Plesant Dale, Tampa, FL, USA

This is more readable than a full address and is probably specific enough to disambiguate most nearby locations.

@jmfield2 Any reason why this wouldn't work?

jmfield2 commented 8 years ago

That may work. I'll check some example queries and see if they are unique enough for what we need. I agree that it probably will look better than how nominatum worked, too.