OpenCageData/address-formatting

`_type` does not match any component

Closed this issue · 3 comments

From @mtmail in #9, I got this advice:

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.

You appear to have tried improving this for v1 of your API:

The formatted placename is created from the various terms in the components hash. This is the raw data we have to work with. We are often asked if there is a definitive list of all possible component keys. Unfortunately not. For convenience we add the key _type with the value set to what we believe the matched location to be. In the case where we can't determine a type we set the value unknown.

I tried to use your API in this manner, but got a response like this at (43.07930055693775, -87.88164978116998):

"components" : {
   "_type" : "house",
   "building" : "Sandburg Commons",
   "city" : "Milwaukee",
   "country" : "United States of America",
   "country_code" : "us",
   "county" : "Milwaukee County",
   "postcode" : "53211",
   "road" : "North Maryland Avenue",
   "state" : "Wisconsin",
   "suburb" : "Downer Woods"
},
"formatted" : "Sandburg Commons, North Maryland Avenue, Milwaukee, WI 53211, United States of America"

You'll notice the key component is declared as house in _type, but the key component, "Sandburg Commons", appears to actually keyed by building.

I've found this eliminates some of the usefulness of _type.

Please advise. :)

cc/ @freyfogle

Hi,
Yes, since @mtmail's comment in Jan 2015 we added the _type field. See
http://blog.opencagedata.com/post/143783956328/some-api-enhancements

Nice bug you've found, thanks for reporting. Am working on a fix today. More soon

Ok, this is now fixed. _type is now returned as "building". Thanks for reporting it

I've verified this is fixed. Thank you @freyfogle!