Comment 11 for bug 1508169

Revision history for this message
Zhang Enwei (zhangew401) wrote :

Hi Kyle,
I have implemented this patch. At the same time I got answer from OSM(OpenStreetMap), they suggested we use Open Cage API(http://geocoder.opencagedata.com/api.html#formatte) which uses the same database of OSM but the address is formatted.
Below is a comparison between the two solutions. IMHO, Open Cage works well.
the value of address is got from OSM which is the basis for me to format.
the value of display_name is used by current solution, also from OSM.
the value of formated_name is the result after I adapted address according to LC_ADDRESS.
the value of opencage is I got by using Open Cage API.
German
"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"
"address":{"bus_stop":"S+U Brandenburger Tor","road":"Under the linden trees","suburb":"Mitte","city_district":"Mitte","city":"Berlin","state":"Berlin","postcode":"10117","country":"Germany","country_code":"de"}
display_name: S+U Brandenburger Tor, Unter den Linden, Mitte, Berlin, 10117, Deutschland
formated_name: Unter den Linden, 10117, Berlin, Deutschland
opencage: S+U Brandenburger Tor, Unter den Linden, 10117 Berlin, Deutschland

American
"%a%N%f%N%d%N%b%N%h %s %e %r%N%T, %S %z%N%c%N"
"address":{"house_number":"199","road":"Little Johnston Valley Road","hamlet":"Lawnville","county":"Roane County","state":"Tennessee","postcode":"37763","country":"United States of America","country_code":"us"}
display_name: 199, Little Johnston Valley Road, Lawnville, Roane County, Tennessee, 37763, United States of America
formated_name: 199, Little Johnston Valley Road, Lawnville, Tennessee, 37763, United States of America
opencage: 199 Little Johnston Valley Road, Lawnville, TN 37763, United States of America

Japan
"%z%c%T%s%b%e%r"
"address":{"park":"Shinjuku Central Park","pedestrian":"水の広場","city":"Shinjuku","state":"Tokyo","region":"Kanto","postcode":"163-8001","country":"Japan","country_code":"jp"}
display_name: 新宿中央公園, 水の広場, 新宿区, 東京都, 関東地方, 163-8001, 日本
formated_name: 163-8001, 東京都, 新宿区, 日本
opencage: 新宿中央公園, 水の広場, 163-8001 新宿区, 日本

Indian
LC_ADDRESS=en_IN.UTF-8
"%z%c%T%s%b%e%r"//this is wrong
display_name: NH 744, Kollam, Kerala, 691001, India
formated_name: 691001, India, Kollam, NH 744
opencage: NH 744, Kollam - 691001, Kerala, India // this is correct

China
display_name: 金牛镇,青县,沧州/cangzhou,中国
formated_name: 青县,中国
opencage: 金牛镇,青县, 中国