From: Sarah Hoffmann Date: Wed, 18 Dec 2019 20:55:17 +0000 (+0100) Subject: Merge pull request #1596 from mtmail/remove-obsolete-wikidata-scripts X-Git-Tag: v3.5.0~115 X-Git-Url: https://git.openstreetmap.org/nominatim.git/commitdiff_plain/2be70b2c365ac5cdb15f0800463d19e72999cd92?hp=2051a84a09d4a370fa74db1ba8742e9095b842fc Merge pull request #1596 from mtmail/remove-obsolete-wikidata-scripts remove old wikidata script. See data-sources/wikipedia-wikidata/ for new process --- diff --git a/data-sources/wikipedia-wikidata/import_wikipedia.sh b/data-sources/wikipedia-wikidata/import_wikipedia.sh index 8b8ba52a..9cc9b1df 100755 --- a/data-sources/wikipedia-wikidata/import_wikipedia.sh +++ b/data-sources/wikipedia-wikidata/import_wikipedia.sh @@ -52,6 +52,10 @@ do echo "insert into wikipedia_redirect select '${i}',page_title,rd_title from ${i}redirect join ${i}page on (rd_from = page_id) where page_namespace = 0 and rd_namespace = 0;" | psqlcmd echo "alter table ${i}pagelinkcount add column othercount integer;" | psqlcmd echo "update ${i}pagelinkcount set othercount = 0;" | psqlcmd +done + +for i in "${language[@]}" +do for j in "${language[@]}" do echo "update ${i}pagelinkcount set othercount = ${i}pagelinkcount.othercount + x.count from (select page_title as title,count from ${i}langlinks join ${i}page on (ll_from = page_id) join ${j}pagelinkcount on (ll_lang = '${j}' and ll_title = title)) as x where x.title = ${i}pagelinkcount.title;" | psqlcmd diff --git a/lib/template/details-html.php b/lib/template/details-html.php index cfba6eb3..f0798773 100644 --- a/lib/template/details-html.php +++ b/lib/template/details-html.php @@ -20,20 +20,25 @@ } - function format_distance($fDistance) + function format_distance($fDistance, $bInMeters = false) { - // $fDistance is in meters - if ($fDistance < 1) - { - return '0'; - } - elseif ($fDistance < 1000) - { - return'~'.(round($fDistance,0)).' m'; - } - else - { - return'~'.(round($fDistance/1000,1)).' km'; + if ($bInMeters) { + // $fDistance is in meters + if ($fDistance < 1) { + return '0'; + } + elseif ($fDistance < 1000) { + return '~'.(round($fDistance,0)).' m'; + } + else { + return '~'.(round($fDistance/1000,1)).' km'; + } + } else { + if ($fDistance == 0) { + return '0'; + } else { + return ''.(round($fDistance,4)).''; + } } } @@ -60,7 +65,7 @@ } - function _one_row($aAddressLine){ + function _one_row($aAddressLine, $bDistanceInMeters = false){ $bNotUsed = isset($aAddressLine['isaddress']) && !$aAddressLine['isaddress']; echo ''."\n"; @@ -69,7 +74,7 @@ echo ' ' . osmLink($aAddressLine) . "\n"; echo ' ' . (isset($aAddressLine['rank_address']) ? $aAddressLine['rank_address'] : '') . "\n"; echo ' ' . ($aAddressLine['admin_level'] < 15 ? $aAddressLine['admin_level'] : '') . "\n"; - echo ' ' . format_distance($aAddressLine['distance'])."\n"; + echo ' ' . format_distance($aAddressLine['distance'], $bDistanceInMeters)."\n"; echo ' ' . detailsLink($aAddressLine,'details >') . "\n"; echo "\n"; } @@ -173,7 +178,7 @@ { headline('Linked Places'); foreach ($aLinkedLines as $aAddressLine) { - _one_row($aAddressLine); + _one_row($aAddressLine, true); } } @@ -212,7 +217,7 @@ headline3($sGroupHeading); foreach ($aHierarchyLines as $aAddressLine) { - _one_row($aAddressLine); + _one_row($aAddressLine, true); } } if (count($aHierarchyLines) >= 500) { diff --git a/osm2pgsql b/osm2pgsql index 8d9087f1..3a045d7f 160000 --- a/osm2pgsql +++ b/osm2pgsql @@ -1 +1 @@ -Subproject commit 8d9087f1111f4a062158e8e6b10bfbceed90899b +Subproject commit 3a045d7f15adc05d34a719da4266418e9663b322 diff --git a/settings/import-address.style b/settings/import-address.style index 0a866c95..8d622ec1 100644 --- a/settings/import-address.style +++ b/settings/import-address.style @@ -73,8 +73,8 @@ } }, { - "keys" : ["country_code", "ISO3166-1", "is_in:country_code", "is_in_country", - "addr:country", "addr:country", "addr:country_code"], + "keys" : ["country_code", "ISO3166-1", "is_in:country_code", "is_in:country", + "addr:country", "addr:country_code"], "values" : { "" : "country" } diff --git a/settings/import-admin.style b/settings/import-admin.style index 02a54f12..2ad6cec8 100644 --- a/settings/import-admin.style +++ b/settings/import-admin.style @@ -42,8 +42,8 @@ } }, { - "keys" : ["country_code", "ISO3166-1", "is_in:country_code", "is_in_country", - "addr:country", "addr:country", "addr:country_code"], + "keys" : ["country_code", "ISO3166-1", "is_in:country_code", "is_in:country", + "addr:country", "addr:country_code"], "values" : { "" : "country" } diff --git a/settings/import-full.style b/settings/import-full.style index de91fd9c..9069c780 100644 --- a/settings/import-full.style +++ b/settings/import-full.style @@ -186,8 +186,8 @@ } }, { - "keys" : ["country_code", "ISO3166-1", "is_in:country_code", "is_in_country", - "addr:country", "addr:country", "addr:country_code"], + "keys" : ["country_code", "ISO3166-1", "is_in:country_code", "is_in:country", + "addr:country", "addr:country_code"], "values" : { "" : "country" } diff --git a/settings/import-street.style b/settings/import-street.style index 42419275..088c1155 100644 --- a/settings/import-street.style +++ b/settings/import-street.style @@ -42,8 +42,8 @@ } }, { - "keys" : ["country_code", "ISO3166-1", "is_in:country_code", "is_in_country", - "addr:country", "addr:country", "addr:country_code"], + "keys" : ["country_code", "ISO3166-1", "is_in:country_code", "is_in:country", + "addr:country", "addr:country_code"], "values" : { "" : "country" }