diff --git a/VAGRANT.md b/VAGRANT.md index c662d5e4..3a8e479b 100644 --- a/VAGRANT.md +++ b/VAGRANT.md @@ -129,7 +129,7 @@ No. Long running Nominatim installations will differ once new import features (o bug fixes) get added since those usually only get applied to new/changed data. Also this document skips the optional Wikipedia data import which affects ranking -of search results. See [Nominatim instllation](http://wiki.openstreetmap.org/wiki/Nominatim/Installation) for details. +of search results. See [Nominatim installation](http://wiki.openstreetmap.org/wiki/Nominatim/Installation) for details. ##### Why Ubuntu, can I test CentOS/CoreOS/FreeBSD? @@ -158,6 +158,8 @@ you edit `settings/local.php` with pgsql://postgres@localhost:9999/nominatim_it +To access postgres directly remember to specify the hostname, e.g. `psql --host localhost --port 9999 nominatim_it` + ##### My computer is slow and the import takes too long. Can I start the virtual machine "in the cloud"? diff --git a/lib/template/address-html.php b/lib/template/address-html.php new file mode 100644 index 00000000..1f18e96c --- /dev/null +++ b/lib/template/address-html.php @@ -0,0 +1,127 @@ + + + + + + + + + + + + + +
+ + + + '; + ?> +
+ + + + + + + +
+
+
+
+ + + + + + + + + + + + + + diff --git a/lib/template/details-error-html.php b/lib/template/details-error-html.php index 1268414d..1c6d2a0a 100644 --- a/lib/template/details-error-html.php +++ b/lib/template/details-error-html.php @@ -1,180 +1,133 @@ - - - - OpenStreetMap Nominatim: <?php echo $aPointDetails['localname'];?> - - - - - - -
-

-
-
Type:
- OSM: '.$sOSMType.' '. $aPointDetails['osm_id'].'
'; + + function osm_link($aFeature) + { + $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':''))); + if ($sOSMType) { + return ''.$sOSMType.' '.$aFeature['osm_id'].''; + } + return ''; + } + + function osm_map_url($aFeature) + { + $sLon = $aFeature['error_x']; + $sLat = $aFeature['error_y']; + + if (isset($sLat)) + { + $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':''))); + if ($sOSMType) + { + return "http://www.openstreetmap.org/?lat=".$sLat."&lon=".$sLon."&zoom=18&layers=M&".$sOSMType."=".$aFeature['osm_id']; + } + } + return ''; + } + + function josm_edit_url($aFeature) + { + $fWidth = 0.0002; + $sLon = $aFeature['error_x']; + $sLat = $aFeature['error_y']; + + if (isset($sLat)) + { + return "http://localhost:8111/load_and_zoom?left=".($sLon-$fWidth)."&right=".($sLon+$fWidth)."&top=".($sLat+$fWidth)."&bottom=".($sLat-$fWidth); + } + + $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':''))); + if ($sOSMType) + { + return 'http://localhost:8111/import?url=http://www.openstreetmap.org/api/0.6/'.$sOSMType.'/'.$aFeature['osm_id'].'/full'; + // Should be better to load by object id - but this doesn't seem to zoom correctly + // return " Remote Control (JOSM / Merkaartor)"; + } + return ''; + } + + function potlach_edit_url($aFeature) + { + $fWidth = 0.0002; + $sLat = $aFeature['error_y']; + $sLon = $aFeature['error_x']; + + if (isset($sLat)) + { + return "http://www.openstreetmap.org/edit?editor=potlatch2&bbox=".($sLon-$fWidth).",".($sLat-$fWidth).",".($sLon+$fWidth).",".($sLat+$fWidth); + } + return ''; + } + + + ?> -

This object has an invalid geometry.

-

Details: +

+
+
-$sVal = $aPointDetails['errormessage']?$aPointDetails['errormessage']:' '; -$sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':''))); -$sOSMID = $aPointDetails['osm_id']; -if (isset($aPointDetails['error_x'])) -{ - $sLat = $aPointDetails['error_y']; - $sLon = $aPointDetails['error_x']; - echo "".$sVal.""; -} -else -{ - echo $sVal; -} -?> -

Edit: in Remote Control (JOSM / Merkaartor)"; - echo " | Potlatch 2"; -} -else -{ - echo " Remote Control (JOSM / Merkaartor)"; - // Should be better to load by object id - but this doesn't seem to zoom correctly - //echo " Remote Control (JOSM / Merkaartor)"; -} +

+
+

This object has an invalid geometry.

-?>

+
+ Type: +
- - +
+ OSM: +
+ +

Error

+

+ +

+ + view on osm.org + + +

Edit

+ +
+
+
+
+
+ +
+ + + + + + + + \ No newline at end of file diff --git a/lib/template/details-html.php b/lib/template/details-html.php index 1da69301..548cee7a 100644 --- a/lib/template/details-html.php +++ b/lib/template/details-html.php @@ -1,172 +1,211 @@ - - - - OpenStreetMap Nominatim: <?php echo $aPointDetails['localname'];?> - - - - - - -
'; - if ($aPointDetails['icon']) - { - echo ''.$aPointDetails['icon'].''; - } - echo $aPointDetails['localname']."\n"; - echo '
'; - echo '
Name: '; - foreach($aPointDetails['aNames'] as $sKey => $sValue) - { - echo '
'.$sValue.' ('.$sKey.')
'; - } - echo '
'; - echo '
Type: '.$aPointDetails['class'].':'.$aPointDetails['type'].'
'; - echo '
Last Updated: '.$aPointDetails['indexed_date'].'
'; - echo '
Admin Level: '.$aPointDetails['admin_level'].'
'; - echo '
Rank: '.$aPointDetails['rank_search_label'].'
'; - if ($aPointDetails['calculated_importance']) echo '
Importance: '.$aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)').'
'; - echo '
Coverage: '.($aPointDetails['isarea']=='t'?'Polygon':'Point').'
'; - echo '
Centre Point: '.$aPointDetails['lat'].','.$aPointDetails['lon'].'
'; - $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':''))); - if ($sOSMType) echo '
OSM: '.$sOSMType.' '.$aPointDetails['osm_id'].'
'; - if ($aPointDetails['wikipedia']) - { - list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aPointDetails['wikipedia']); - echo '
Wikipedia Calculated: '.$aPointDetails['wikipedia'].'
'; - } - echo '
Extra Tags: '; - foreach($aPointDetails['aExtraTags'] as $sKey => $sValue) - { - echo '
'.$sValue.' ('.$sKey.')
'; - } - echo '
'; - echo "
\n"; - echo "

Address

\n"; - echo '
'; - $iPrevRank = 1000000; - $sPrevLocalName = ''; - foreach($aAddressLines as $aAddressLine) - { - $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':''))); + function headline($sTitle) + { + echo "

".$sTitle."

\n"; + } - echo '
'; - if (!($iPrevRank<=$aAddressLine['rank_address'] || $sPrevLocalName == $aAddressLine['localname'])) + function osm_link($aFeature) + { + $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':''))); + if ($sOSMType) { - $iPrevRank = $aAddressLine['rank_address']; - $sPrevLocalName = $aAddressLine['localname']; + return ''.$sOSMType.' '.$aFeature['osm_id'].''; } - echo ''.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'No Name').''; - echo ' ('; - echo 'Type: '.$aAddressLine['class'].':'.$aAddressLine['type'].''; - if ($sOSMType) echo ', '.$sOSMType.' '.$aAddressLine['osm_id'].''; - if (isset($aAddressLine['admin_level'])) echo ', '.$aAddressLine['admin_level'].''; - if (isset($aAddressLine['rank_search_label'])) echo ', '.$aAddressLine['rank_search_label'].''; -// echo ', '.($aAddressLine['fromarea']=='t'?'Polygon':'Point').''; - echo ', '.$aAddressLine['distance'].''; - echo ' GOTO'; - echo ')'; - echo "
\n"; + return ''; } - echo "
\n"; + + function wikipedia_link($aFeature) + { + if ($aFeature['wikipedia']) + { + list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aFeature['wikipedia']); + return ''.$aFeature['wikipedia'].''; + } + return ''; + } + + function nominatim_link($aFeature, $sTitle) + { + return ''.$sTitle.''; + } + + function format_distance($fDistance) + { + // $fDistance is in meters + if ($fDistance < 1) + { + return '0'; + } + elseif ($fDistance < 1000) + { + return'~'.(round($fDistance,0)).' m'; + } + else + { + return'~'.(round($fDistance/1000,1)).' km'; + } + } + + function kv($sKey,$sValue) + { + echo ' ' . $sKey . ''.$sValue.''. "\n"; + } + + + function hash_to_subtable($aAssociatedList) + { + $sHTML = ''; + foreach($aAssociatedList as $sKey => $sValue) + { + $sHTML = $sHTML.'
'.$sValue.' ('.$sKey.')
'."\n"; + } + return $sHTML; + } + + // function hash_to_subtable($aAssociatedList) + // { + // $sHTML = ''; + // foreach($aAssociatedList as $sKey => $sValue) + // { + // $sHTML = $sHTML . ''."\n"; + // } + // $sHTML = $sHTML . '
'.$sKey.''.$sValue.'
'; + // return $sHTML; + // } + + + function map_icon($sIcon) + { + if ($sIcon){ + echo ''.$sIcon.''; + } + } + + + function _one_row($aAddressLine){ + $bNotUsed = (isset($aAddressLine['isaddress']) && $aAddressLine['isaddress'] == 'f'); + + echo ''; + echo ' '.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'No Name').''; + echo ' ' . $aAddressLine['class'].':'.$aAddressLine['type'] . ''; + echo ' ' . osm_link($aAddressLine) . ''; + echo ' ' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . ''; + // echo '' . (isset($aAddressLine['rank_search_label']) ? $aAddressLine['rank_search_label'] : '') .''; + // echo ', '.($aAddressLine['fromarea']=='t'?'Polygon':'Point').''; + echo ' ' . format_distance($aAddressLine['distance']).'';; + echo ' ' . nominatim_link($aAddressLine,'details >') . '';; + echo "\n"; + } + +?> + + + + +
+
+
+

+
+
+ +
+
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
+ +

Address

+ + + + + + + + + + + + + + + + + + +
Local nameTypeOSMAdmin levelDistance
+ + +Linked Places\n"; - echo '
'; + headline('Linked Places'); + echo ''; foreach($aLinkedLines as $aAddressLine) { - $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':''))); - - echo '
'; - echo ''.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'No Name').''; - echo ' ('; - echo 'Type: '.$aAddressLine['class'].':'.$aAddressLine['type'].''; - if ($sOSMType) echo ', '.$sOSMType.' '.$aAddressLine['osm_id'].''; - echo ', '.$aAddressLine['admin_level'].''; - if (isset($aAddressLine['rank_search_label'])) echo ', '.$aAddressLine['rank_search_label'].''; -// echo ', '.($aAddressLine['fromarea']=='t'?'Polygon':'Point').''; - echo ', '.$aAddressLine['distance'].''; - echo ' GOTO'; - echo ')'; - echo "
\n"; + _one_row($aAddressLine); } - echo "\n"; + echo '
'; } + + if ($aPlaceSearchNameKeywords) { - echo '

Name Keywords

'; + headline('Name Keywords'); foreach($aPlaceSearchNameKeywords as $aRow) { echo '
'.$aRow['word_token']."
\n"; @@ -175,7 +214,7 @@ if ($aPlaceSearchAddressKeywords) { - echo '

Address Keywords

'; + headline('Address Keywords'); foreach($aPlaceSearchAddressKeywords as $aRow) { echo '
'.($aRow['word_token'][0]==' '?'*':'').$aRow['word_token'].'('.$aRow['word_id'].')'."
\n"; @@ -184,7 +223,7 @@ if (sizeof($aParentOfLines)) { - echo "

Parent Of:

\n
\n"; + headline('Parent Of'); $aGroupedAddressLines = array(); foreach($aParentOfLines as $aAddressLine) @@ -200,31 +239,39 @@ { $sGroupHeading = ucwords($sGroupHeading); echo "

$sGroupHeading

\n"; - foreach($aParentOfLines as $aAddressLine) - { - $aAddressLine['localname'] = $aAddressLine['localname']?$aAddressLine['localname']:$aAddressLine['housenumber']; - $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':''))); - - echo '
'; - echo ''.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'No Name').''; - echo ' ('; - echo ''.($aAddressLine['isarea']=='t'?'Polygon':'Point').''; - echo ', ~'.(round($aAddressLine['distance']*69,1)).' miles'; - if ($sOSMType) echo ', '.$sOSMType.' '.$aAddressLine['osm_id'].''; - echo ', GOTO'; - echo ')'; - echo "
\n"; - } + + echo ''; + foreach($aParentOfLines as $aAddressLine) + { + _one_row($aAddressLine); + } + echo '
'; } if (sizeof($aParentOfLines) >= 500) { echo '

There are more child objects which are not shown.

'; } - echo '
'; } -// echo '

Other Parts:

'; -// echo '

Linked To:

'; + // headline('Other Parts'); + // headline('Linked To'); ?> - +
+
+
+ + + + + + + diff --git a/lib/template/includes/html-footer.php b/lib/template/includes/html-footer.php new file mode 100644 index 00000000..3083c11b --- /dev/null +++ b/lib/template/includes/html-footer.php @@ -0,0 +1,14 @@ +
+

+ Addresses and postcodes are approximate +

+ +
+ + + + + + diff --git a/lib/template/includes/html-header.php b/lib/template/includes/html-header.php new file mode 100644 index 00000000..0832bff3 --- /dev/null +++ b/lib/template/includes/html-header.php @@ -0,0 +1,11 @@ + + + + OpenStreetMap Nominatim: Search + + + + + + + diff --git a/lib/template/includes/html-top-navigation.php b/lib/template/includes/html-top-navigation.php new file mode 100644 index 00000000..e0b367b4 --- /dev/null +++ b/lib/template/includes/html-top-navigation.php @@ -0,0 +1,49 @@ +
+
+ +
+ + Data last updated: +
+ + +
+
+
+ + +
+
+
+
+ + diff --git a/lib/template/includes/introduction.php b/lib/template/includes/introduction.php new file mode 100644 index 00000000..7a76a959 --- /dev/null +++ b/lib/template/includes/introduction.php @@ -0,0 +1,2 @@ +

This is Nominatim

+abc def diff --git a/lib/template/includes/report-errors.php b/lib/template/includes/report-errors.php new file mode 100644 index 00000000..f6b04e7e --- /dev/null +++ b/lib/template/includes/report-errors.php @@ -0,0 +1,24 @@ +

+ Before reporting problems please read the user documentation + and + FAQ. + + If your problem relates to the address of a particular search result please use the 'details' link + to check how the address was generated before reporting a problem. +

+

+ Use Nominatim issues on github + to report problems. + +

+

+ Please ensure that you include a full description of the problem, including the search + query that you used, the problem with the result and, if the problem relates to missing data, + the osm type (node, way, relation) and id of the item that is missing. +

+

+ Problems that contain enough detail are likely to get looked at before ones that require + significant research. +

diff --git a/lib/template/search-html.php b/lib/template/search-html.php index 7da79ad8..e523c446 100644 --- a/lib/template/search-html.php +++ b/lib/template/search-html.php @@ -1,300 +1,112 @@ - - - - OpenStreetMap Nominatim: Search - - - + + - - - - - - - + -
+ -
-
- - - - - - - - - - - -
logo /> HighlightData: -Documentation | FAQ
-
-
- - -
-
-Suggest: '.$sSuggestion.'
'; - } - foreach($aSearchResults as $iResNum => $aResult) - { - if ($aResult['aBoundingBox']) - { - echo '
\n"; - } - elseif (isset($aResult['zoom'])) - { - echo '
'; - } - else - { - echo '
'; - } - - echo (isset($aResult['icon'])?'icon':''); - echo ' '.htmlspecialchars($aResult['name']).''; - echo ' '.round($aResult['lat'],3).','.round($aResult['lon'],3).''; - echo ' '.$aResult['place_id'].''; - if (isset($aResult['label'])) - echo ' ('.$aResult['label'].')'; - else if ($aResult['type'] == 'yes') - echo ' ('.ucwords(str_replace('_',' ',$aResult['class'])).')'; - else - echo ' ('.ucwords(str_replace('_',' ',$aResult['type'])).')'; - echo ' (details)'; - echo '
'; - } - if (sizeof($aSearchResults)) - { - if ($sMoreURL) - { - echo ''; - } - } - else - { - echo '
No search results found
'; - } - -?> -
Addresses and postcodes are approximate - +
- +
+ + + + + + +
+ +
+
+ + -
-