OpenCageData / address-formatting

templates to format geographic addresses
MIT License
395 stars 84 forks source link

House Value for your Reverse Geocoder #9

Closed taylortrimble closed 8 years ago

taylortrimble commented 9 years ago

I noticed that for your geocoder, the "house" value in these templates will sometimes be filled with other values like "library". Do you have a list of these substitution values?

Example (see "library" and "formatted"):

$ curl -i -X GET 'https://api.opencagedata.com/geocode/v1/json?pretty=1&no_annotations=1&key=<redacted>&q=+44.9753,-93.2359'
HTTP/1.1 200 OK
Date: Sat, 03 Jan 2015 02:52:24 GMT
Server: Apache/2.4.7 (Ubuntu)
X-ratelimit-reset: 1420329600
X-ratelimit-remaining: 2490
X-ratelimit-limit: 2500
Access-control-allow-origin: *
Strict-Transport-Security: max-age=31536000; includeSubDomains
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8

{
   "licenses" : [
      {
         "name" : "CC-BY-SA",
         "url" : "http://creativecommons.org/licenses/by-sa/3.0/"
      },
      {
         "name" : "ODbL",
         "url" : "http://opendatacommons.org/licenses/odbl/summary/"
      }
   ],
   "rate" : {
      "limit" : 2500,
      "remaining" : 2490,
      "reset" : 1420329600
   },
   "results" : [
      {
         "bounds" : {
            "northeast" : {
               "lat" : 44.9755634,
               "lng" : -93.2358856
            },
            "southwest" : {
               "lat" : 44.9749964,
               "lng" : -93.2367022
            }
         },
         "components" : {
            "city" : "Minneapolis",
            "country" : "United States of America",
            "country_code" : "us",
            "county" : "Hennepin County",
            "house_number" : "117",
            "library" : "Walter Library",
            "neighbourhood" : "Marcy-Holmes",
            "postcode" : "55455",
            "road" : "Southeast Pleasant Street",
            "state" : "Minnesota",
            "suburb" : "Phillips"
         },
         "confidence" : 10,
         "formatted" : "Walter Library, 117 Southeast Pleasant Street, Minneapolis MN 55455, United States of America",
         "geometry" : {
            "lat" : 44.9753648,
            "lng" : -93.2362952210992
         }
      }
   ],
   "status" : {
      "code" : 200,
      "message" : "OK"
   },
   "thanks" : "For using an OpenCage Data API",
   "timestamp" : {
      "created_http" : "Sat, 03 Jan 2015 02:52:24 GMT",
      "created_unix" : 1420253544
   },
   "total_results" : 1,
   "we_are_hiring" : "http://lokku.com/#jobs"
}
mtmail commented 9 years ago

Hi, For the address formatting we treat anything that's not a component (anything not listed in https://github.com/lokku/address-formatting/blob/master/conf/components.yaml) to be a name and put it first in the formatted string.

So it's kind of a negative list. The positive list would be 1000s of items (user generated content). Any type of shop, any kind of building. Below a top 300 list.

house residential unclassified yes tertiary secondary houses primary parking bus_stop stream locality village hamlet service pitch trunk track place_of_worship living_street school motorway river swimming_pool bench restaurant park street_lamp administrative level_crossing pedestrian road water fire_hydrant peak footway information playground fuel path garden supermarket convenience culvert stop forest post_box bank hotel fast_food cafe grave_yard isolated_dwelling tree abandoned meadow island recycling cycleway kindergarten platform pharmacy farmland hospital motorway_junction post_office bicycle_parking sports_centre station public_building pub waste_basket toilets taxiway shelter construction clothes telephone memorial give_way reservoir drinking_water motorway_link switch suburb industrial bakery buffer_stop atm attraction town hairdresser viewpoint picnic_site fire_station police bar tram car_repair townhall cemetery parking_space canal dam milestone disused crossing camp_site islet hunting_stand vending_machine nature_reserve neighbourhood fountain car wayside_cross library museum proposed ruins trunk_link guest_house common quarry aerodrome kiosk doctors viaduct primary_link tram_stop university steps farm recreation_ground wood bay riverbank social_facility farmyard monument stadium doityourself archaeological_site runway car_wash phone artwork ditch butcher building_passage allotments college florist subway drain mall spring bus_station golf_course halt wayside_shrine helipad marketplace narrow_gauge pylon dentist secondary_link castle waste_disposal protected_area postcode commercial community_centre bicycle furniture cliff beach signal alcohol apron speed_camera books taxi theatre slipway electronics shoes motel light_rail company chalet grass wetland department_store retail subway_entrance hardware cinema marina tertiary_link bunker government hostel jewelry emergency_access_point optician boundary_stone bicycle_rental veterinary gift mobile_phone caravan_site clinic parking_entrance beauty greengrocer chemist cave_entrance raceway garden_centre nursing_home estate_agent courthouse arts_centre preserved nightclub computer sports alpine_hut gate confectionery rest_area bbq passing_place bridleway ferry_terminal picnic_table laundry variety_store travel_agency postal_code beverages building national_park car_parts stationery city toys military defibrillator newsagent grit_bin hangar insurance water_park orchard chair_lift dry_cleaning car_rental heritage ford motorcycle biergarten shower vacant pet county clock elevator emergency_phone services turning_loop hifi prison boutique terminal embassy driving_school citywalls drag_lift ice_cream waterfall barracks car_sharing garages basin lawyer artificial tyres deli political zoo mine_shaft theme_park vineyard outdoor razed charging_station village_green sauna scrub copyshop cadastral dismantled landfill miniature_golf saddle funeral_directors airstrip cape fishing tomb dog_park glacier tailor video parking_position weir region art kitchen bureau_de_change horse_riding emergency_bay miniature telecommunication railway_crossing conservation stone railway ridge music ngo tobacco photo fabric corridor seafood carpenter ambulance_station land interior_decoration second_hand boat_storage childcare nuclear_explosion_site brownfield Residential massage aqueduct church holding_position forest_compartment motorcycle_parking local_authority charity it fishmonger turntable shop pa educational_institution platter general food_court ice_rink trade studio parking;fuel paint mine lot wreck musical_instrument watering_place monorail rock heath fitness_station roman_road water_tank suspension antiques fort plot landing_site accountant manor windsock beach_resort volcano greenfield state 1 city_block lock_gate brothel dock ticket bookmaker trench wine shoemaker street_light research employment_agency rapids photographer casino retirement_home unknown t-bar travel_agent gambling valley firepit pawnbroker bed tattoo wilderness_hut electrician

taylortrimble commented 9 years ago

Awesome, that makes sense to me. I should note that in components.yaml I see house and building are aliased, but I see different formatting behavior for both of them. Here is an example:

    components =         {
        building = "Dinnaken House";
        city = Minneapolis;
        country = "United States of America";
        "country_code" = us;
        county = "Hennepin County";
        road = "Southeast Washington Avenue";
        state = Minnesota;
        suburb = Longfellow;
    };
    confidence = 10;
    formatted = "Southeast Washington Avenue, Minneapolis MN, United States of America";

    ------------------------------------

    components =         {
        city = Minneapolis;
        country = "United States of America";
        "country_code" = us;
        county = "Hennepin County";
        house = "Argyle House";
        "house_number" = 920;
        road = "Southeast Delaware Street";
        state = Minnesota;
        suburb = Phillips;
    };
    confidence = 10;
    formatted = "Argyle House, 920 Southeast Delaware Street, Minneapolis MN, United States of America";

I do know how to proceed here for my purposes, but I was still sort of wondering about that.

Thanks for the help!

freyfogle commented 8 years ago

Hi @tylrtrmbl

very sorry for the delay in replying, I somehow just plain missed this. I'm having trouble recreating the bug, when I search for "44.9732959, -93.2246761" I get a formatted value of "Dinnaken House, Southeast Washington Avenue, Minneapolis, MN 55414, United States of America"

Can you send me the query you are making? thanks again and apologies once more for the silence.

taylortrimble commented 8 years ago

Hi @freyfogle:

I'm sure it's simply been fixed. Thank you.