Cleanups and rename service nominatim -> geocoder

This commit is contained in:
Bryan Housel
2017-01-17 16:56:23 +05:30
parent 489a25fe74
commit d09fd15092
5 changed files with 51 additions and 62 deletions
+2 -7
View File
@@ -84,7 +84,7 @@ en:
# access=*
label: Access
address:
# 'addr:block_number=*, addr:city=*, addr:conscriptionnumber=*, addr:county=*, addr:country=*, addr:district=*, addr:floor=*, addr:hamlet=*, addr:housename=*, addr:housenumber=*, addr:neighbourhood=*, addr:place=*, addr:postcode=*, addr:province=*, addr:quarter=*, addr:state=*, addr:street=*, addr:subdistrict=*, addr:suburb=*'
# 'addr:block_number=*, addr:city=*, addr:block_number=*, addr:conscriptionnumber=*, addr:county=*, addr:country=*, addr:county=*, addr:district=*, addr:floor=*, addr:hamlet=*, addr:housename=*, addr:housenumber=*, addr:neighbourhood=*, addr:place=*, addr:postcode=*, addr:province=*, addr:quarter=*, addr:state=*, addr:street=*, addr:subdistrict=*, addr:suburb=*'
label: Address
placeholders:
block_number: Block Number
@@ -110,12 +110,7 @@ en:
province: Province
province!jp: Prefecture
quarter: Quarter
quarter!jp: Ōaza/Mach
neighbourhood: Neighbourhood
place: Place
postcode: Postcode
province: Province
quarter: Quarte
quarter!jp: Ōaza/Machi
state: State
street: Street
subdistrict: Subdistrict
+12 -14
View File
@@ -109,38 +109,36 @@
"label": "Address",
"strings": {
"placeholders": {
"block_number": "Block number",
"city": "City",
"block_number": "Block Number",
"block_number!jp": "Block No.",
"city": "City",
"city!jp": "City/Town/Village/Tokyo Special Ward",
"city!vn": "City/Town",
"conscriptionnumber": "123",
"county": "County",
"country": "Country",
"county": "County",
"county!jp": "District",
"district": "District",
"district!vn": "Arrondissement/Town/District",
"floor": "Floor",
"hamlet": "Hamlet",
"housename": "Housename",
"housenumber": "123",
"housenumber!jp": "Building No./Lot No.",
"neighbourhood": "Neighbourhood",
"neighbourhood!jp": "Chōme/Aza/Koaza",
"place": "Place",
"postcode": "Postcode",
"province": "Province",
"province!jp": "Prefecture",
"quarter": "Quarter",
"quarter!jp": "Ōaza/Machi",
"state": "State",
"street": "Street",
"subdistrict": "Subdistrict",
"suburb": "Suburb",
"subdistrict!vn": "Ward/Commune/Townlet",
"district!vn": "Arrondissement/Town/District",
"city!vn": "City/Town",
"province!jp": "Prefecture",
"county!jp": "District",
"city!jp": "City/Town/Village/Tokyo Special Ward",
"suburb!jp": "Ward",
"quarter!jp": "Ōaza/Machi",
"neighbourhood!jp": "Chōme/Aza/Koaza",
"block_number!jp": "Block No.",
"housenumber!jp": "Building No./Lot No."
"suburb": "Suburb",
"suburb!jp": "Ward"
}
}
},
+12 -14
View File
@@ -29,38 +29,36 @@
"label": "Address",
"strings": {
"placeholders": {
"block_number": "Block number",
"city": "City",
"block_number": "Block Number",
"block_number!jp": "Block No.",
"city": "City",
"city!jp": "City/Town/Village/Tokyo Special Ward",
"city!vn": "City/Town",
"conscriptionnumber": "123",
"county": "County",
"country": "Country",
"county": "County",
"county!jp": "District",
"district": "District",
"district!vn": "Arrondissement/Town/District",
"floor": "Floor",
"hamlet": "Hamlet",
"housename": "Housename",
"housenumber": "123",
"housenumber!jp": "Building No./Lot No.",
"neighbourhood": "Neighbourhood",
"neighbourhood!jp": "Chōme/Aza/Koaza",
"place": "Place",
"postcode": "Postcode",
"province": "Province",
"province!jp": "Prefecture",
"quarter": "Quarter",
"quarter!jp": "Ōaza/Machi",
"state": "State",
"street": "Street",
"subdistrict": "Subdistrict",
"suburb": "Suburb",
"subdistrict!vn": "Ward/Commune/Townlet",
"district!vn": "Arrondissement/Town/District",
"city!vn": "City/Town",
"province!jp": "Prefecture",
"county!jp": "District",
"city!jp": "City/Town/Village/Tokyo Special Ward",
"suburb!jp": "Ward",
"quarter!jp": "Ōaza/Machi",
"neighbourhood!jp": "Chōme/Aza/Koaza",
"block_number!jp": "Block No.",
"housenumber!jp": "Building No./Lot No."
"suburb": "Suburb",
"suburb!jp": "Ward"
}
}
}
+12 -14
View File
@@ -789,38 +789,36 @@
"address": {
"label": "Address",
"placeholders": {
"block_number": "Block number",
"city": "City",
"block_number": "Block Number",
"block_number!jp": "Block No.",
"city": "City",
"city!jp": "City/Town/Village/Tokyo Special Ward",
"city!vn": "City/Town",
"conscriptionnumber": "123",
"county": "County",
"country": "Country",
"county": "County",
"county!jp": "District",
"district": "District",
"district!vn": "Arrondissement/Town/District",
"floor": "Floor",
"hamlet": "Hamlet",
"housename": "Housename",
"housenumber": "123",
"housenumber!jp": "Building No./Lot No.",
"neighbourhood": "Neighbourhood",
"neighbourhood!jp": "Chōme/Aza/Koaza",
"place": "Place",
"postcode": "Postcode",
"province": "Province",
"province!jp": "Prefecture",
"quarter": "Quarter",
"quarter!jp": "Ōaza/Machi",
"state": "State",
"street": "Street",
"subdistrict": "Subdistrict",
"suburb": "Suburb",
"subdistrict!vn": "Ward/Commune/Townlet",
"district!vn": "Arrondissement/Town/District",
"city!vn": "City/Town",
"province!jp": "Prefecture",
"county!jp": "District",
"city!jp": "City/Town/Village/Tokyo Special Ward",
"suburb!jp": "Ward",
"quarter!jp": "Ōaza/Machi",
"neighbourhood!jp": "Chōme/Aza/Koaza",
"block_number!jp": "Block No.",
"housenumber!jp": "Building No./Lot No."
"suburb": "Suburb",
"suburb!jp": "Ward"
}
},
"admin_level": {
+13 -13
View File
@@ -16,11 +16,9 @@ import { utilGetSetValue } from '../../util/get_set_value';
export function uiFieldAddress(field, context) {
var dispatch = d3.dispatch('init', 'change'),
nominatim = services.nominatim,
nominatim = services.geocoder,
wrap = d3.select(null),
isInitialized = false,
widths,
addrTags,
entity;
function getNearStreets() {
@@ -122,8 +120,10 @@ export function uiFieldAddress(field, context) {
return a && a.countryCodes && _.includes(a.countryCodes, countryCode);
}) || _.first(dataAddressFormats);
if (typeof addressFormat.widths !== 'undefined') { widths = addressFormat.widths; }
else { widths = {housenumber: 1/3, street: 2/3, city: 2/3, state: 1/4, postcode: 1/3}; }
var widths = addressFormat.widths || {
housenumber: 1/3, street: 2/3,
city: 2/3, state: 1/4, postcode: 1/3
};
function row(r) {
// Normalize widths.
@@ -150,23 +150,24 @@ export function uiFieldAddress(field, context) {
.append('input')
.property('type', 'text')
.attr('placeholder', function (d) {
var countryInserter = '';
if (addressFormat.customPlaceholders.indexOf(d.id) !== -1) { countryInserter = '!' + countryCode; }
return field.t('placeholders.' + d.id + countryInserter); })
var localkey = d.id + '!' + countryCode,
tkey = field.strings.placeholders[localkey] ? localkey : d.id;
return field.t('placeholders.' + tkey);
})
.attr('class', function (d) { return 'addr-' + d.id; })
.style('width', function (d) { return d.width * 100 + '%'; });
// Update
// setup dropdowns for common address tags
if (typeof addressFormat.dropdowns !== 'undefined') { addrTags = addressFormat.dropdowns; }
else { addrTags = [
var dropdowns = addressFormat.dropdowns || [
'city', 'county', 'country', 'district', 'hamlet',
'neighbourhood', 'place', 'postcode', 'province',
'quarter', 'state', 'street', 'subdistrict', 'suburb'
]; }
];
// If fields exist for any of these tags, create dropdowns to pick nearby values..
addrTags.forEach(function(tag) {
dropdowns.forEach(function(tag) {
var nearValues = (tag === 'street') ? getNearStreets
: (tag === 'city') ? getNearCities
: getNearValues;
@@ -202,7 +203,6 @@ export function uiFieldAddress(field, context) {
.attr('class', 'preset-input-wrap')
.merge(wrap);
if (nominatim && entity) {
var center = entity.extent(context.graph()).center();
nominatim.countryCode(center, initCallback);