Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions app/assets/javascripts/index/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,15 @@ OSM.Query = function (map) {
function featurePrefix(feature) {
const tags = feature.tags;
let prefix = "";

if (tags.boundary === "administrative" && (tags.border_type || tags.admin_level)) {
// Keep in sync with qualified_boundary_types in Searches.NominatimQueriesController.create.
const qualifiedBoundaryTypes = [
"administrative",
"census",
"religious_administration",
"statistical"
];

if (qualifiedBoundaryTypes.includes(tags.boundary) && (tags.border_type || tags.admin_level)) {
prefix = OSM.i18n.t("geocoder.search_osm_nominatim.border_types." + tags.border_type, {
defaultValue: OSM.i18n.t("geocoder.search_osm_nominatim.admin_levels.level" + tags.admin_level, {
defaultValue: OSM.i18n.t("geocoder.search_osm_nominatim.prefix.boundary.administrative")
Expand Down
9 changes: 8 additions & 1 deletion app/controllers/searches/nominatim_queries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ def create
else
t "geocoder.search_osm_nominatim.prefix.#{klass}.#{type}", :default => type.tr("_", " ").capitalize
end
if klass == "boundary" && type == "administrative"
# Keep in sync with qualifiedBoundaryTypes in OSM.Query.featurePrefix.
qualified_boundary_types = %w[
administrative
census
religious_administrative
statistical
]
if klass == "boundary" && qualified_boundary_types.include?(type)
rank = (place.attributes["address_rank"].to_i + 1) / 2
prefix_name = t "geocoder.search_osm_nominatim.admin_levels.level#{rank}", :default => prefix_name
border_type = nil
Expand Down
56 changes: 56 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1543,32 +1543,88 @@ en:
level10: "Administrative Boundary (Level 10)"
level11: "Administrative Boundary (Level 11)"
border_types:
archdiocese: "Archdiocesan Boundary"
arrondissement: "Arrondissement Boundary"
audiencia: "Audiencia Boundary"
borough: "Borough Boundary"
caliphate: "Caliphal Boundary"
canton: "Cantonal Boundary"
captaincy_general: "Captaincy General Boundary"
census_area: "Census Area Boundary"
cercle: "Cercle Boundary"
chiefdom: "Chiefdom Boundary"
city: "City Boundary"
city-state: "City-State Boundary"
colony: "Colonial Boundary"
comarca: "Comarca Boundary"
commonwealth: "Commonwealth Boundary"
commune: "Communal Boundary"
condominium: "Condominium Boundary"
confederation: "Confederational Boundary"
county: "County Boundary"
departement: "Departmental Boundary"
department: "Departmental Boundary"
diocese: "Diocesan Boundary"
district: "District Boundary"
distrito: "District Boundary"
dominion: "Dominion Boundary"
emirate: "Empirate Boundary"
empire: "Imperial Boundary"
eyalet: "Eyalet Boundary"
federal_district: "Federal District Boundary"
federation: "Federation Boundary"
freguesia: "Freguesia Boundary"
ghetto: "Ghetto Boundary"
governorate: "Governorate Boundary"
hundred: "Hundred Boundary"
intendancy: "Intendancy Boundary"
kingdom: "Kingdom Boundary"
local_authority: "Local Authority Boundary"
major_division: "Major Division Boundary"
markaz: "Markaz Boundary"
municipality: "Municipal Boundary"
municipi: "Municipal Boundary"
município: "Municipal Boundary"
nation: "International Boundary"
national: "International Boundary"
neighbourhood: "Neighborhood Boundary"
oblast: "Oblast Boundary"
occupation: "Occupational Boundary"
overseas_collectivity: "Overseas Collectivity"
overseas_department: "Overseas Department"
overseas_territory: "Overseas Territory"
parish: "Parish Boundary"
planning_region: "Planning Region Boundary"
possession: "Possession Boundary"
prefecture: "Prefectural Boundary"
prefecture_apostolic: "Prefecture Apostolic Boundary"
principate: "Principate Boundary"
protectorate: "Protectorate Boundary"
province: "Provincial Boundary"
rancho: "Rancho Boundary"
realm: "Realm Boundary"
região: "Regional Boundary"
region: "Regional Boundary"
reichsgau: "Reichsgau Boundary"
republic: "Republican Boundary"
rode: "Rode Boundary"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this in response to a request on the forum.

sanjak: "Sanjak Boundary"
sector: "Sectoral Boundary"
shire: "Shire Boundary"
state: "State Boundary"
subdistrict: "Subdistrict Boundary"
sultanate: "Sultanate Boundary"
territory: "Territorial Boundary"
territorial_prelature: "Territorial Prelature Boundary"
town: "Town Boundary"
township: "Township Boundary"
vicariate_apostolic: "Vicariate Apostolic Boundary"
viceroyalty: "Viceroyalty Boundary"
village: "Village Boundary"
viyalet: "Viyalet Boundary"
voivodeship: "Voivodeship Boundary"
ward: "Ward Boundary"
zone: "Zonal Boundary"
searches:
show:
title:
Expand Down
Loading