From 1ff3a56d1668166c6b11cb00eb1c8cafeaebd546 Mon Sep 17 00:00:00 2001 From: Emmanuel Dewaele Date: Thu, 25 Jun 2015 21:47:34 +0200 Subject: [PATCH 1/8] Popup title is the same as popup name For the sake of consistency, when no name is provided, the popup title may be taken from "ref" or "operator" as in getName() --- js/poi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/poi.js b/js/poi.js index c934d29..6d89662 100644 --- a/js/poi.js +++ b/js/poi.js @@ -150,7 +150,7 @@ POI.prototype.getInfoBox = function(){ content+='
'; //name - content+='

' +((this.element.tags.hasOwnProperty("name")) ? this.element.tags["name"]:"----")+'

'; + content+='

' +(this.getName()?this.getName():"---")+'

'; //addr content+=''+((this.element.tags.hasOwnProperty("addr:city")) ? this.element.tags["addr:city"]+', ' : "")+((this.element.tags.hasOwnProperty("addr:street")) ? this.element.tags["addr:street"]+', ' : "")+((this.element.tags.hasOwnProperty("addr:housenumber")) ? this.element.tags["addr:housenumber"]+', ' : "")+''; From 07ebfecf1656fa1ddd2132501f6cdf6006bd9cda Mon Sep 17 00:00:00 2001 From: Emmanuel Dewaele Date: Fri, 3 Jul 2015 22:58:31 +0200 Subject: [PATCH 2/8] "Locate" button was not translated Changed Nomimatim widget so that that it uses the translated string --- js/Control.NominatimGeocoder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/Control.NominatimGeocoder.js b/js/Control.NominatimGeocoder.js index 7632e8f..2cccf97 100644 --- a/js/Control.NominatimGeocoder.js +++ b/js/Control.NominatimGeocoder.js @@ -2,7 +2,7 @@ L.Control.NominatimGeocoder = L.Control.extend({ options: { collapsed: true, position: 'topright', - text: 'Locate', + text: lang_locate, callback: function (results) { // Check if no results are returned if (results.length >= 1) { From be71ececfb965b463a70830efe4ce19e14270acf Mon Sep 17 00:00:00 2001 From: Emmanuel Dewaele Date: Sat, 4 Jul 2015 23:40:48 +0200 Subject: [PATCH 3/8] #31 getting addresses from Nominatim When a POI does not have street name and house number, the address is obtained from Nominatim --- js/main.js | 6 +++-- js/poi.js | 49 +++++++++++++++++++++++++++++++++++-- nominatim_reverse_proxy.php | 6 +++++ 3 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 nominatim_reverse_proxy.php diff --git a/js/main.js b/js/main.js index 5e42f0f..35efbe2 100644 --- a/js/main.js +++ b/js/main.js @@ -476,10 +476,12 @@ var zoomControl = L.control.zoom({ map.on('locationerror', onLocationError); map.on('moveend', nominatimQuery); - map.on('popupopen', function() { + map.on('popupopen', function(e) { var href=$("#plusone-div").data("href"); var size=$("#plusone-div").data("size"); - gapi.plusone.render("plusone-div",{'size':size,'href':href}); + //gapi.plusone.render("plusone-div",{'size':size,'href':href}); + // we make sure that a proper address is displayed + e.popup._source.el.fetchAddress(); }); n=true; var href=$("#main-plus").data("href"); diff --git a/js/poi.js b/js/poi.js index fc83394..13bfe8b 100644 --- a/js/poi.js +++ b/js/poi.js @@ -152,8 +152,10 @@ POI.prototype.getInfoBox = function(){ //name content+='

' +(this.getName()?this.getName():"---")+'

'; //addr - content+=''+((this.element.tags.hasOwnProperty("addr:city")) ? this.element.tags["addr:city"]+', ' : "")+((this.element.tags.hasOwnProperty("addr:street")) ? this.element.tags["addr:street"]+', ' : "")+((this.element.tags.hasOwnProperty("addr:housenumber")) ? this.element.tags["addr:housenumber"]+', ' : "")+''; - + if(this.element.tags.hasOwnProperty("addr:housenumber") && this.element.tags.hasOwnProperty("addr:street")) + content+=''+((this.element.tags.hasOwnProperty("addr:city")) ? this.element.tags["addr:city"]+', ' : "")+this.element.tags["addr:street"]+', ' +this.element.tags["addr:housenumber"]+''; + else + content+='
'+lang_loading+'
'; //net content+='
'; content += this.__genItems({tag:['contact:email','email'],icon:'glyphicon glyphicon-envelope',href:'mailto:'}); @@ -284,3 +286,46 @@ POI.prototype.updateShadow = function (now){ return false; return true; }; + +/* + Determine the address of a POI, if it is unknown +*/ +POI.prototype.fetchAddress = function(){ + var typeTable = {"node":"N","way":"W","relation":"R"}; + var addressDiv = this.element.type+this.element.id; + // if the address has not been determined yet + if($("#"+addressDiv).html() == lang_loading) + { + var requestData; + if(this.element.tags.hasOwnProperty("addr:housenumber")) + { + if(this.element.type) + requestData = {osm_type:typeTable[this.element.type],osm_id:this.element.id}; + else + // way objects have no key type, no idea why + requestData = {osm_type:this.element.id[0].toUpperCase(),osm_id:this.element.id.substr(1)}; + } + else + requestData = {lon:this.element.lon,lat:this.element.lat}; + + $.ajax({ + url: 'nominatim_reverse_proxy.php', + dataType: "json", + data: requestData, + number : this.element.tags["addr:housenumber"], + addressDiv : addressDiv, + success: function(nominatim){ + var wayName = nominatim.address.road; + if(!wayName)wayName = nominatim.address.pedestrian; + if(!wayName)wayName = nominatim.address.footway; + var cityName = nominatim.address.city; + if(!cityName)cityName = nominatim.address.town; + if(!cityName)cityName = nominatim.address.village; + var displayedAddress = cityName?cityName:""; + displayedAddress += (wayName?", "+wayName:""); + displayedAddress += (this.number?", "+this.number:""); + $("#"+this.addressDiv).html(''+displayedAddress+''); + } + }); + } +}; diff --git a/nominatim_reverse_proxy.php b/nominatim_reverse_proxy.php new file mode 100644 index 0000000..ee11e33 --- /dev/null +++ b/nominatim_reverse_proxy.php @@ -0,0 +1,6 @@ + \ No newline at end of file From dcc43331a2d9ad598814052b7fd51fba7143a26c Mon Sep 17 00:00:00 2001 From: edewaele Date: Tue, 7 Jul 2015 09:48:25 +0200 Subject: [PATCH 4/8] French for organic --- lang/fr_FR.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/fr_FR.php b/lang/fr_FR.php index 3cfddef..f1d4ec1 100644 --- a/lang/fr_FR.php +++ b/lang/fr_FR.php @@ -180,7 +180,7 @@ define('PANEL_STORE_ART','Art'); define('PANEL_STORE_CLOTHES','Vêtements'); define('PANEL_STORE_FOOD','Alimentation'); -define('PANEL_STORE_ORGANIC','Organic'); +define('PANEL_STORE_ORGANIC','Bio'); define('PANEL_STORE_ELECTRONIC','Électronique'); define('PANEL_STORE_HEALTH_AND_BEAUTY','Soins et beauté'); define('PANEL_STORE_TRANSPORT','Transport'); From 90516f5072ba9a31b30190bb9644739f6acb6f7a Mon Sep 17 00:00:00 2001 From: Emmanuel Dewaele Date: Tue, 7 Jul 2015 20:37:02 +0200 Subject: [PATCH 5/8] Fixing POI URLs without http:// or https:// Many website keys are not preceded with the protocol identifier, which must me added in the href --- js/poi.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/poi.js b/js/poi.js index 13bfe8b..1ad2310 100644 --- a/js/poi.js +++ b/js/poi.js @@ -160,7 +160,11 @@ POI.prototype.getInfoBox = function(){ content+='
'; content += this.__genItems({tag:['contact:email','email'],icon:'glyphicon glyphicon-envelope',href:'mailto:'}); content += this.__genItems({tag:['contact:phone','phone'],icon:'glyphicon glyphicon-phone-alt',href:'tel:'}); - content += this.__genItems({tag:['contact:website','website'],icon:'glyphicon glyphicon-globe',href:''}); + content += this.__genItems({tag:['contact:website','website'],icon:'glyphicon glyphicon-globe',href:'', + hrefFunc:function(nn){ + // some website values have no protocol indication, resulting in a misintrepretation of the URL (eg. http://osm24.eu/www.jeudepaume.org) + return (nn.indexOf('http://') == -1 && nn.indexOf('https://') == -1)?'http://'+nn:nn; + }}); content += this.__genItems({tag:['contact:facebook'],icon:'glyphicon glyphicon-globe',name:"Facebook",href:'',hrefFunc: function(nn){return ((nn.indexOf('/') === -1)?"http://facebook.com/":"")+nn;}}); From afd64fc3de727a525257c8783abe779a2cfef079 Mon Sep 17 00:00:00 2001 From: Emmanuel Dewaele Date: Sat, 11 Jul 2015 22:35:29 +0200 Subject: [PATCH 6/8] "Open OSM" may be translated This fixes the last untranslated string in issue #8 --- js/poi.js | 4 ++-- js_lang.php | 1 + lang/de_DE.php | 1 + lang/en_EN.php | 1 + lang/fr_FR.php | 1 + lang/it_IT.php | 1 + lang/ru_RU.php | 1 + lang/uk_UA.php | 1 + 8 files changed, 9 insertions(+), 2 deletions(-) diff --git a/js/poi.js b/js/poi.js index 1ad2310..6febbc4 100644 --- a/js/poi.js +++ b/js/poi.js @@ -197,9 +197,9 @@ POI.prototype.getInfoBox = function(){ content+=''; if(this.element.id[0]!='w') - content+="Open OSM"; + content+=""+lang_open_osm+""; else - content+="Open OSM"; + content+=""+lang_open_osm+""; content+='
'; diff --git a/js_lang.php b/js_lang.php index 3c187d2..f38dc8e 100644 --- a/js_lang.php +++ b/js_lang.php @@ -20,6 +20,7 @@ var lang_loading=''; var lang_please_zoom_in=''; var lang_open=''; +var lang_open_osm=''; var lang_last_hour=''; var lang_close=''; var lang_nodata=''; diff --git a/lang/de_DE.php b/lang/de_DE.php index bb99b09..6fd7a32 100644 --- a/lang/de_DE.php +++ b/lang/de_DE.php @@ -348,6 +348,7 @@ define('JS_LOADING','Lade...'); define('JS_PLEASE_ZOOM_IN','Bitte hineinzoomen'); define('JS_OPEN','Offen'); +define('JS_OPEN_OSM','Open in OSM'); define('JS_LAST_HOUR','Letzte Stunde'); define('JS_CLOSE','Geschlossen'); define('JS_NO_DATA','Keine Daten'); diff --git a/lang/en_EN.php b/lang/en_EN.php index e24e879..7a0935a 100644 --- a/lang/en_EN.php +++ b/lang/en_EN.php @@ -349,6 +349,7 @@ define('JS_LOADING','Loading...'); define('JS_PLEASE_ZOOM_IN','Please zoom in'); define('JS_OPEN','Open'); +define('JS_OPEN_OSM','Open in OSM'); define('JS_LAST_HOUR','Last hour'); define('JS_CLOSE','Closed'); define('JS_NO_DATA','No data'); diff --git a/lang/fr_FR.php b/lang/fr_FR.php index f1d4ec1..e230245 100644 --- a/lang/fr_FR.php +++ b/lang/fr_FR.php @@ -349,6 +349,7 @@ define('JS_LOADING','Chargement...'); define('JS_PLEASE_ZOOM_IN','Zoomez pour voir les points d\'intérêt'); define('JS_OPEN','Ouvert'); +define('JS_OPEN_OSM','Ouvrir dans OpenStreetMap'); define('JS_LAST_HOUR','Moins d\'une heure'); define('JS_CLOSE','Fermé'); define('JS_NO_DATA','Inconnu'); diff --git a/lang/it_IT.php b/lang/it_IT.php index a3bc9e8..a7a3cbf 100644 --- a/lang/it_IT.php +++ b/lang/it_IT.php @@ -345,6 +345,7 @@ define('JS_LOADING','Loading...'); define('JS_PLEASE_ZOOM_IN','Please zoom in'); define('JS_OPEN','Open'); +define('JS_OPEN_OSM','Open in OSM'); define('JS_LAST_HOUR','Last hour'); define('JS_CLOSE','Closed'); define('JS_NO_DATA','No data'); diff --git a/lang/ru_RU.php b/lang/ru_RU.php index a56b586..251d12c 100644 --- a/lang/ru_RU.php +++ b/lang/ru_RU.php @@ -351,6 +351,7 @@ define('JS_LOADING','Идет загрузка...'); define('JS_PLEASE_ZOOM_IN','Приблизьте карту, чтобы увидеть объекты'); define('JS_OPEN','Открыто'); +define('JS_OPEN_OSM','Open in OSM'); define('JS_LAST_HOUR','Последний час'); define('JS_CLOSE','Закрыто'); define('JS_NO_DATA','Нет данных'); diff --git a/lang/uk_UA.php b/lang/uk_UA.php index 7ba1eb3..4188984 100644 --- a/lang/uk_UA.php +++ b/lang/uk_UA.php @@ -351,6 +351,7 @@ define ('JS_LOADING', 'Йде завантаження…'); define ('JS_PLEASE_ZOOM_IN', 'Наблизьте мапу, щоб побачити об’єкти'); define ('JS_OPEN', 'Відкрито'); +define('JS_OPEN_OSM','Open in OSM'); define ('JS_LAST_HOUR', 'Остання година'); define ('JS_CLOSE', 'Зачинено'); define ('JS_NO_DATA', 'Дані'); From f7a0033cd443b0ceb4cf7bad1130fc01cb3e3bf4 Mon Sep 17 00:00:00 2001 From: Emmanuel Dewaele Date: Thu, 30 Jul 2015 15:53:05 +0200 Subject: [PATCH 7/8] Added amenity=post_office (fixes issue #37) --- img/icons/amenity_post_office.png | Bin 0 -> 833 bytes js/poi.js | 2 +- lang/en_EN.php | 1 + lang/fr_FR.php | 1 + lang/it_IT.php | 1 + lang/ru_RU.php | 1 + lang/uk_UA.php | 1 + main.php | 1 + taginfo.json | 4 ++++ 9 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 img/icons/amenity_post_office.png diff --git a/img/icons/amenity_post_office.png b/img/icons/amenity_post_office.png new file mode 100644 index 0000000000000000000000000000000000000000..06a42148f5031462b68cfb0d8b33e78bbb9ff2cf GIT binary patch literal 833 zcmV-H1HSx;P)A}ghHVOaV-dgh=fwgZ0;@BPEC_eGIQW?DQWNb=RfDBIVE%mA$q7Ew0wzGLbE1@*mMnM;*wkyaAO~XL4S3P(#N1_7!#^vf z?kF&X5Z`Q9Z0l=Esk?5s8|?1xva_?3D|k2@((m{2Jnv2j@x_$EZoDc$5pZB}Pt#|P z>2{Naz?X=aGfkH}{QGeJ7x-PQebhRgjvqx40IgOFDP^#>4Ov4#0}f+b^y?5Gzh~mpHuMg z@G!U20P^aYa@NK=I5^<&@Gw|(qTOx>H#awauh%Q~N!aW4czk^HPft(ZIdOh|?vKag zVxNSqRttdfc>K<0Ddik)zLUEH&1Mt(@%vG&qbQ=;Y%&-O@^heGuczJ+U@#a^uh;Vv z@cjIoxwdJ4lPF+oYwNH7?^o?nw%$)?o|iP3JORIe*RpmX*5eX-Xs|~! z2f*{ZAAr9~gnalft&fM(72~;C?eQ&KCc=Wd z`YuhKZ2`;2^A*EnS;IGU)|65|Z4nmytA@Yoj1B0cD5YttB_cMA6S_aloxf&*rxvh8 z#HJQ;udnTC=t~xOCIJf~YC0?W(nMSTmIa*VFUN~ZtEO3C|kj`XWP$BKp00000 LNkvXXu0mjf;0A>z literal 0 HcmV?d00001 diff --git a/js/poi.js b/js/poi.js index 6febbc4..d001a58 100644 --- a/js/poi.js +++ b/js/poi.js @@ -10,7 +10,7 @@ var shop_icons=["alcohol",'antiques',"art", var leisure_icons=['pitch','swimming_pool','stadium','track','sports_centre']; var amenity_icons=['atm','bar','bank','biergarten','cafe','cinema','clinic','college','dentist','doctors','drinking_water', 'fast_food','fuel','hospital','ice_cream','kindergarten','library','nightclub', -'pub','pharmacy','restaurant','school','shelter','social_facility','stripclub','theatre','toilets','university','veterinary']; +'pub','pharmacy','restaurant','school','shelter','social_facility','stripclub','theatre','toilets','university','veterinary','post_office']; var office_icons=[]; var craft_icons=['key_cutter','clockmaker','glaziery','photographer','shoemaker','tailor']; var emergency_icons=['ambulance_station','defibrillator']; diff --git a/lang/en_EN.php b/lang/en_EN.php index 7a0935a..1ad32ff 100644 --- a/lang/en_EN.php +++ b/lang/en_EN.php @@ -142,6 +142,7 @@ define('PANEL_OFFICE_ASSOCIATION','Association'); define('PANEL_OFFICE_LAWYER','Lawyer'); define('PANEL_OFFICE_NOTARY','Notary'); +define('PANEL_OFFICE_POST_OFFICE','Post office'); define('PANEL_CRAFT_LIST','Type'); define('PANEL_CRAFT_ALL','All'); diff --git a/lang/fr_FR.php b/lang/fr_FR.php index e230245..84970be 100644 --- a/lang/fr_FR.php +++ b/lang/fr_FR.php @@ -142,6 +142,7 @@ define('PANEL_OFFICE_ASSOCIATION','Association'); define('PANEL_OFFICE_LAWYER','Avocat'); define('PANEL_OFFICE_NOTARY','Notaire'); +define('PANEL_OFFICE_POST_OFFICE','Bureau de poste'); define('PANEL_CRAFT_LIST','Type'); define('PANEL_CRAFT_ALL','Tous'); diff --git a/lang/it_IT.php b/lang/it_IT.php index a7a3cbf..6427f55 100644 --- a/lang/it_IT.php +++ b/lang/it_IT.php @@ -138,6 +138,7 @@ define('PANEL_OFFICE_ASSOCIATION','Associazioni'); define('PANEL_OFFICE_LAWYER','Avvocato'); define('PANEL_OFFICE_NOTARY','Notarile'); +define('PANEL_OFFICE_POST_OFFICE','Post office'); define('PANEL_CRAFT_LIST','Tipo'); define('PANEL_CRAFT_ALL','Tutto'); diff --git a/lang/ru_RU.php b/lang/ru_RU.php index 251d12c..438d2cb 100644 --- a/lang/ru_RU.php +++ b/lang/ru_RU.php @@ -143,6 +143,7 @@ define('PANEL_OFFICE_ASSOCIATION','Association'); define('PANEL_OFFICE_LAWYER','Юрист'); define('PANEL_OFFICE_NOTARY','Нотариус'); +define('PANEL_OFFICE_POST_OFFICE','Post office'); define('PANEL_CRAFT_LIST','Профессия'); define('PANEL_CRAFT_ALL','Все'); diff --git a/lang/uk_UA.php b/lang/uk_UA.php index 4188984..f417b4e 100644 --- a/lang/uk_UA.php +++ b/lang/uk_UA.php @@ -143,6 +143,7 @@ define ('PANEL_OFFICE_ASSOCIATION', 'Товариство'); define ('PANEL_OFFICE_LAWYER', 'Юрист'); define ('PANEL_OFFICE_NOTARY', 'Нотаріус'); +define('PANEL_OFFICE_POST_OFFICE','Post office'); define ('PANEL_CRAFT_LIST', 'Професія'); define ('PANEL_CRAFT_ALL', 'Усе'); diff --git a/main.php b/main.php index dc4eb30..133410d 100644 --- a/main.php +++ b/main.php @@ -313,6 +313,7 @@
  • +
  • diff --git a/taginfo.json b/taginfo.json index f054ca4..49e417c 100644 --- a/taginfo.json +++ b/taginfo.json @@ -458,6 +458,10 @@ { "key": "amenity", "value": "social_facility" + }, + { + "key": "amenity", + "value": "post_office" }, { "key": "amenity", From fa8800905a4d9d56693e4e7ec838f5914344cb30 Mon Sep 17 00:00:00 2001 From: Emmanuel Dewaele Date: Thu, 30 Jul 2015 15:53:05 +0200 Subject: [PATCH 8/8] Added amenity=post_office (fixes issue #37) Added amenity=post_office (fixes issue #37) Added amenity=post_office (fixes issue #37) --- main.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.php b/main.php index 133410d..d5606a5 100644 --- a/main.php +++ b/main.php @@ -95,7 +95,7 @@