]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 10 Jun 2019 17:05:18 +0000 (19:05 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 10 Jun 2019 17:05:18 +0000 (19:05 +0200)
22 files changed:
docs/admin/Faq.md
docs/admin/Import-and-Update.md
docs/admin/Installation.md
docs/admin/Migration.md
docs/api/Details.md
docs/api/Faq.md
docs/api/Lookup.md
docs/api/Output.md
docs/api/Reverse.md
docs/api/Search.md
docs/develop/Import.md
docs/develop/Ranking.md
docs/develop/overview.md
lib/init-website.php
lib/setup/SetupClass.php
osm2pgsql
sql/functions.sql
sql/update-postcodes.sql
test/bdd/environment.py
test/bdd/osm2pgsql/import/tags.feature
test/bdd/osm2pgsql/update/simple.feature
vagrant/Install-on-Ubuntu-18-nginx.sh

index db5e101c83dbfafc579ad03ea693b029343fdb66..485ba25bebedca821eee4dcd0d2be52dd5725356 100644 (file)
@@ -24,14 +24,14 @@ If the reported rank is 26 or higher, you can also safely add `--index-noanalyse
 
 ### PHP "open_basedir restriction in effect" warnings
 
-    `PHP Warning:  file_get_contents(): open_basedir restriction in effect.`
+    PHP Warning:  file_get_contents(): open_basedir restriction in effect.
 
-You need to adjust the [open_basedir](http://www.php.net/manual/en/ini.core.php#ini.open-basedir) setting
+You need to adjust the [open_basedir](https://www.php.net/manual/en/ini.core.php#ini.open-basedir) setting
 in your PHP configuration (`php.ini file`). By default this setting may look like this:
 
     open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/
 
-Either add reported directories to the list or disable this setting temporarily by 
+Either add reported directories to the list or disable this setting temporarily by
 dding ";" at the beginning of the line. Don't forget to enable this setting again
 once you are done with the PHP command line operations.
 
@@ -44,9 +44,9 @@ The Apache log may contain lots of PHP warnings like this:
 You should set the default time zone as instructed in the warning in
 your `php.ini` file. Find the entry about timezone and set it to
 something like this:
-  
+
     ; Defines the default timezone used by the date functions
-    ; http://php.net/date.timezone
+    ; https://php.net/date.timezone
     date.timezone = 'America/Denver'
 
 Or
@@ -66,6 +66,14 @@ server development libraries (`postgresql-server-dev-9.5` on Ubuntu)
 and recompile (`cmake .. && make`).
 
 
+## I see the error "ERROR: permission denied for language c"
+
+`nominatim.so`, written in C, is required to be installed on the database
+server. Some managed database (cloud) services like Amazon RDS do not allow
+this. There is currently no work-around other than installing a database
+on a non-managed machine.
+
+
 ### I see the error: "function transliteration(text) does not exist"
 
 Reinstall the nominatim functions with `setup.php --create--functions`
@@ -83,11 +91,11 @@ vboxfs.
 
 ### nominatim UPDATE failed: ERROR: buffer 179261 is not owned by resource owner Portal
 
-Several users [reported this](https://github.com/openstreetmap/Nominatim/issues/1168) during the initial import of the database. It's 
-something Postgresql internal Nominatim doesn't control. And Postgresql forums
+Several users [reported this](https://github.com/openstreetmap/Nominatim/issues/1168) during the initial import of the database. It's
+something PostgreSQL internal Nominatim doesn't control. And PostgreSQL forums
 suggest it's threading related but definitely some kind of crash of a process.
 Users reported either rebooting the server, different hardware or just trying
-the import again worked. 
+the import again worked.
 
 ### The website shows: "Could not get word tokens"
 
@@ -140,7 +148,7 @@ Example error message
    CONTEXT: PL/pgSQL function make_standard_name(text) line 5 at assignment]
 ```
 
-The Postgresql database, i.e. user postgres, needs to have access to that file.
+The PostgreSQL database, i.e. user `postgres`, needs to have access to that file.
 
 The permission need to be read & executable by everybody, e.g.
 
@@ -155,7 +163,7 @@ When running SELinux, make sure that the
 
 ### Setup.php fails with "DB Error: extension not found"
 
-Make sure you have the Postgres extensions hstore and postgis installed.
+Make sure you have the PostgreSQL extensions "hstore" and "postgis" installed.
 See the installation instruction for a full list of required packages.
 
 
@@ -165,7 +173,7 @@ See the installation instruction for a full list of required packages.
 
 The message is a bit misleading as PHP needs to load the file `DB.php` and
 instead re-loads Nominatim's `db.php`. To solve this make sure you
-have the [Pear module 'DB'](http://pear.php.net/package/DB/) installed.
+have the [Pear module 'DB'](https://pear.php.net/package/DB/) installed.
 
     sudo pear install DB
 
@@ -190,7 +198,7 @@ For updates you need to download the change files for each country
 once per day and apply them **separately** using
 
     ./utils/update.php --import-diff <filename> --index
-    
+
 See [this issue](https://github.com/openstreetmap/Nominatim/issues/60#issuecomment-18679446)
 for a script that runs the updates using osmosis.
 
index 3d0905975b571093391bac217cd1bc58aede2dcc..ad7773642ec37a49ec366fa6c151f9e4a4c96a9e 100644 (file)
@@ -36,7 +36,7 @@ the directory exists. There should be at least 40GB of free space.
 ### Wikipedia rankings
 
 Wikipedia can be used as an optional auxiliary data source to help indicate
-the importance of osm features. Nominatim will work without this information
+the importance of OSM features. Nominatim will work without this information
 but it will improve the quality of the results if this is installed.
 This data is available as a binary download:
 
@@ -45,7 +45,7 @@ This data is available as a binary download:
     wget https://www.nominatim.org/data/wikipedia_redirect.sql.bin
 
 Combined the 2 files are around 1.5GB and add around 30GB to the install
-size of nominatim. They also increase the install time by an hour or so.
+size of Nominatim. They also increase the install time by an hour or so.
 
 *NOTE:* you'll need to download the Wikipedia rankings before performing
 the initial import of the data if you want the rankings applied to the
@@ -53,7 +53,7 @@ loaded data.
 
 ### UK postcodes
 
-Nominatim can use postcodes from an external source to improve searches that involve a UK postcode. This data can be optionally downloaded: 
+Nominatim can use postcodes from an external source to improve searches that involve a UK postcode. This data can be optionally downloaded:
 
     cd $NOMINATIM_SOURCE_DIR/data
     wget https://www.nominatim.org/data/gb_postcode_data.sql.gz
@@ -77,7 +77,7 @@ below. There are also
 
 Please be aware that some extracts are not cut exactly along the country
 boundaries. As a result some parts of the boundary may be missing which means
-that cannot compute the areas for some administrative areas.
+that Nominatim cannot compute the areas for some administrative areas.
 
 ### Dropping Data Required for Dynamic Updates
 
@@ -99,7 +99,7 @@ database or reuse the space later.
 
 If you only want to use the Nominatim database for reverse lookups or
 if you plan to use the installation only for exports to a
-[photon](http://photon.komoot.de/) database, then you can set up a database
+[photon](https://photon.komoot.de/) database, then you can set up a database
 without search indexes. Add `--reverse-only` to your setup command above.
 
 This saves about 5% of disk space.
@@ -121,7 +121,7 @@ import styles available which only read selected data:
 
 The style can be changed with the configuration `CONST_Import_Style`.
 
-To give you an idea of the impact of using the different style, the table
+To give you an idea of the impact of using the different styles, the table
 below gives rough estimates of the final database size after import of a
 2018 planet and after using the `--drop` option. It also shows the time
 needed for the import on a machine with 32GB RAM, 4 CPUS and SSDs. Note that
@@ -136,7 +136,7 @@ address   |   59h        |  500 GB    |  260 GB
 full      |   80h        |  575 GB    |  300 GB
 
 You can also customize the styles further. For an description of the
-style format see [the developement section](../develop/Import.md).
+style format see [the development section](../develop/Import.md).
 
 ## Initial import of the data
 
@@ -157,7 +157,7 @@ about the same size as the file you are importing but never more than
 2/3 of RAM available. If your machine starts swapping reduce the size.
 
 Computing word frequency for search terms can improve the performance of
-forward geocoding in particular under high load as it helps Postgres' query
+forward geocoding in particular under high load as it helps PostgreSQL's query
 planner to make the right decisions. To recompute word counts run:
 
 ```sh
@@ -195,7 +195,7 @@ entire US adds about 10GB to your database.
 
     `data-source/us-tiger/README.md` explains how the data got preprocessed.
 
-  2. Import the data into your Nominatim database: 
+  2. Import the data into your Nominatim database:
 
         ./utils/setup.php --import-tiger-data
 
@@ -212,7 +212,7 @@ entire US adds about 10GB to your database.
 
 ## Updates
 
-There are many different possibilities to update your Nominatim database.
+There are many different ways to update your Nominatim database.
 The following section describes how to keep it up-to-date with Pyosmium.
 For a list of other methods see the output of `./utils/update.php --help`.
 
@@ -241,7 +241,7 @@ to update using the global minutely diffs.
 
 If you want a different update source you will need to add some settings
 to `settings/local.php`. For example, to use the daily country extracts
-diffs for Ireland from geofabrik add the following:
+diffs for Ireland from Geofabrik add the following:
 
     // base URL of the replication service
     @define('CONST_Replication_Url', 'https://download.geofabrik.de/europe/ireland-and-northern-ireland-updates');
@@ -257,7 +257,7 @@ To set up the update process now run the following command:
 It outputs the date where updates will start. Recheck that this date is
 what you expect.
 
-The --init-updates command needs to be rerun whenever the replication service
+The `--init-updates` command needs to be rerun whenever the replication service
 is changed.
 
 #### Updating Nominatim
index 592c6cc19e0b85209da671a0cdfb8d5e0d1f308e..5b7f8173795934fcf98ceea84fe8b7b4051ed5d9 100644 (file)
@@ -34,28 +34,28 @@ osm2pgsql README for additional dependencies required for compiling osm2pgsql.
 For running tests:
 
   * [behave](http://pythonhosted.org/behave/)
-  * [Psycopg2](http://initd.org/psycopg)
+  * [Psycopg2](https://initd.org/psycopg)
   * [nose](https://nose.readthedocs.io)
   * [phpunit](https://phpunit.de)
 
 For running Nominatim:
 
-  * [PostgreSQL](http://www.postgresql.org) (9.1 or later)
-  * [PostGIS](http://postgis.refractions.net) (2.0 or later)
-  * [PHP](http://php.net) (5.4 or later)
+  * [PostgreSQL](https://www.postgresql.org) (9.3 or later)
+  * [PostGIS](https://postgis.org) (2.2 or later)
+  * [PHP](https://php.net) (7.0 or later)
   * PHP-pgsql
   * PHP-intl (bundled with PHP)
-  * [PEAR::DB](http://pear.php.net/package/DB)
+  * [PEAR::DB](https://pear.php.net/package/DB)
   * a webserver (apache or nginx are recommended)
 
 For running continuous updates:
 
-  * [pyosmium](http://osmcode.org/pyosmium/)
+  * [pyosmium](https://osmcode.org/pyosmium/)
 
 ### Hardware
 
 A minimum of 2GB of RAM is required or installation will fail. For a full
-planet import 32GB of RAM or more strongly are recommended.
+planet import 32GB of RAM or more are strongly recommended.
 
 For a full planet install you will need at least 700GB of hard disk space
 (take into account that the OSM database is growing fast). SSD disks
index 0cfe29601fe1abeee03a1ac0bb34329353902e60..ebad9c48a16d67ee1ce376c149d95a27e19846d6 100644 (file)
@@ -3,7 +3,7 @@
 This page describes database migrations necessary to update existing databases
 to newer versions of Nominatim.
 
-SQL statements should be executed from the postgres commandline. Execute
+SQL statements should be executed from the PostgreSQL commandline. Execute
 `psql nominatim` to enter command line mode.
 
 
index 027138a9b73615869f4723bb3eb3a35ae9dcec34..b5405c836e932ef38bc5296b42b55347a73d5476 100644 (file)
@@ -40,7 +40,7 @@ See [Place Output Formats](Output.md) for details on each format. (Default: html
 
 * `json_callback=<string>`
 
-Wrap json output in a callback function (JSONP) i.e. `<string>(<json>)`.
+Wrap JSON output in a callback function (JSONP) i.e. `<string>(<json>)`.
 Only has an effect for JSON output formats.
 
 * `pretty=[0|1]`
index 6bc5b5e831c4cb4adac8adca089aa8e283f7a32d..86f0e7835484628a9702cf23df610ba9b3368a79 100644 (file)
@@ -7,11 +7,11 @@
 Nominatim computes the address from two sources in the OpenStreetMap data:
 from administrative boundaries and from place nodes. Boundaries are the more
 useful source. They precisely describe an area. So it is very clear for
-Nominatim if a point belongs to an area of not. Place nodes are more complicated.
-These are only points without any precise extend. So Nominatim has to take a
-guess and assume that an address belongs to the closest place nose it can find.
+Nominatim if a point belongs to an area or not. Place nodes are more complicated.
+These are only points without any precise extent. So Nominatim has to take a
+guess and assume that an address belongs to the closest place node it can find.
 In an ideal world, Nominatim would not need the place nodes but there are
-many places on earth where there are not precise boundaries available for
+many places on earth where there are no precise boundaries available for
 all parts that make up an address. This is in particular true for the more
 local address parts, like villages and suburbs. Therefore it is not possible
 to completely dismiss place nodes. And sometimes they sneak in where they
@@ -21,7 +21,7 @@ As a OpenStreetMap mapper, you can improve the situation in two ways: if you
 see a place node for which already an administrative area exists, then you
 should _link_ the two by adding the node with a 'label' role to the boundary
 relation. If there is no administrative area, you can add the approximate
-extend of the place and tag it place=<something> as well.
+extent of the place and tag it place=<something> as well.
 
 #### 2. When doing reverse search, the address details have parts that don't contain the point I was looking up.
 
@@ -30,7 +30,7 @@ Reverse does not give you the address of the point you asked for. Reverse
 returns the closest object to the point you asked for and then returns the
 address of that object. Now, if you are close to a border, then the closest
 object may be across that border. When Nominatim then returns the address,
-contains the county/state/country across the border.
+it contains the county/state/country across the border.
 
 #### 3. I get different counties/states/countries when I change the zoom parameter in the reverse query. How is that possible?
 
@@ -45,12 +45,12 @@ sometimes the other for the closest point.
 
 Nominatim assigns each map feature one country. Those outside any administrative
 boundaries are assigned a special no-country. Continents or other super-national
-administrations (e.g. European Union, NATO, Custom unions) are not supported, 
+administrations (e.g. European Union, NATO, Custom unions) are not supported,
 see also [Administrative Boundary](https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#Super-national_administrations).
 
 #### 5. Can you return the timezone?
 
-See this separate OpenStreetMap-based project [Timezone Boundary Builder](https://github.com/evansiroky/timezone-boundary-builder)
+See this separate OpenStreetMap-based project [Timezone Boundary Builder](https://github.com/evansiroky/timezone-boundary-builder).
 
 #### 6. I want to download a list of streets/restaurants of a city/region
 
index 57bf7b5fe41becfda82d20436c399db4ab0bfc77..36672ee7dc24c978deafcfcfd62dcf31ffe1f81a 100644 (file)
@@ -25,7 +25,7 @@ See [Place Output Formats](Output.md) for details on each format. (Default: xml)
 
 * `json_callback=<string>`
 
-Wrap json output in a callback function (JSONP) i.e. `<string>(<json>)`.
+Wrap JSON output in a callback function (JSONP) i.e. `<string>(<json>)`.
 Only has an effect for JSON output formats.
 
 ### Output details
index 4aa4d2982fba304eb4ad6636808506ec88b6fade..df78ed7dfc375a86c5f76787bceaf25d998e632e 100644 (file)
@@ -1,6 +1,6 @@
 # Place Output
 
-The [\reverse](Reverse.md), [\search](Search.md) and [\lookup](Lookup.md)
+The [/reverse](Reverse.md), [/search](Search.md) and [/lookup](Lookup.md)
 API calls produce very similar output which is explained in this section.
 There is one section for each format which is selectable via the `format`
 parameter.
@@ -70,7 +70,7 @@ This is the same as the JSON format with two changes:
 
 ### GeoJSON
 
-This format follows the [RFC7946](http://geojson.org). Every feature includes
+This format follows the [RFC7946](https://geojson.org). Every feature includes
 a bounding box (`bbox`).
 
 The feature list has the following fields:
@@ -83,7 +83,7 @@ The feature list has the following fields:
  * `importance` - computed importance rank
  * `icon` - link to class icon (if available)
  * `address` - dictionary of address details (only with `addressdetails=1`)
- * `extratags` - dictionary with additional useful tags like website or maxspeed
+ * `extratags` - dictionary with additional useful tags like `website` or `maxspeed`
    (only with `extratags=1`)
  * `namedetails` - dictionary with full list of available names including ref etc.
 
@@ -120,7 +120,7 @@ formats depending on the API call.
 
 ```
 <reversegeocode timestamp="Sat, 11 Aug 18 11:53:21 +0000"
-                attribution="Data Â© OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright"
+                attribution="Data Â© OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright"
                 querystring="lat=48.400381&lon=11.745876&zoom=5&format=xml">
   <result place_id="179509537" osm_type="relation" osm_id="2145268" ref="BY"
           lat="48.9467562" lon="11.4038717"
@@ -154,7 +154,7 @@ The place information can be found in the `result` element. The attributes of th
  * `lat`, `lon` - latitude and longitude of the centroid of the object
  * `boundingbox` - comma-separated list of corner coordinates
 
-The full address address of the result can be found in the content of the
+The full address of the result can be found in the content of the
 `result` element as a comma-separated list.
 
 Additional information requested with `addressdetails=1`, `extratags=1` and
@@ -164,12 +164,12 @@ Additional information requested with `addressdetails=1`, `extratags=1` and
 
 ```
 <searchresults timestamp="Sat, 11 Aug 18 11:55:35 +0000"
-               attribution="Data Â© OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright"
+               attribution="Data Â© OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright"
                querystring="london" polygon="false" exclude_place_ids="100149"
                more_url="https://nominatim.openstreetmap.org/search.php?q=london&addressdetails=1&extratags=1&exclude_place_ids=100149&format=xml&accept-language=en-US%2Cen%3Bq%3D0.7%2Cde%3Bq%3D0.3">
   <place place_id="100149" osm_type="node" osm_id="107775" place_rank="15"
          boundingbox="51.3473219,51.6673219,-0.2876474,0.0323526" lat="51.5073219" lon="-0.1276474"
-         display_name="London, Greater London, England, SW1A 2DU, United Kingdom" 
+         display_name="London, Greater London, England, SW1A 2DU, United Kingdom"
          class="place" type="city" importance="0.9654895765402"
          icon="https://nominatim.openstreetmap.org/images/mapicons/poi_place_city.p.20.png">
     <extratags>
@@ -232,7 +232,7 @@ permanent for later use.
 
 The combination `osm_type`+`osm_id` is slighly better but remember in
 OpenStreetMap mappers can delete, split, recreate places (and those
-get a new `osm_id`), there is no link between those old and new id.
+get a new `osm_id`), there is no link between those old and new ids.
 Places can also change their meaning without changing their `osm_id`,
 e.g. when a restaurant is retagged as supermarket. For a more in-depth
 discussion see [Permanent ID](https://wiki.openstreetmap.org/wiki/Permanent_ID).
index 82b4e6f3248761744c6b690729537dde7ecfd37f..13805fd45edc7cab65b80d868270367c54f0777e 100644 (file)
@@ -22,7 +22,7 @@ There are two ways how the requested location can be specified:
 
     A specific OSM node(N), way(W) or relation(R) to return an address for.
 
-In both cases exactly one object is returned. The two input paramters cannot
+In both cases exactly one object is returned. The two input parameters cannot
 be used at the same time. Both accept the additional optional parameters listed
 below.
 
@@ -34,7 +34,7 @@ See [Place Output Formats](Output.md) for details on each format. (Default: html
 
 * `json_callback=<string>`
 
-Wrap json output in a callback function ([JSONP](https://en.wikipedia.org/wiki/JSONP)) i.e. `<string>(<json>)`.
+Wrap JSON output in a callback function ([JSONP](https://en.wikipedia.org/wiki/JSONP)) i.e. `<string>(<json>)`.
 Only has an effect for JSON output formats.
 
 ### Output details
@@ -135,7 +135,7 @@ This overrides the specified machine readable format. (Default: 0)
       <postcode>B72</postcode>
       <country>United Kingdom</country>
       <country_code>gb</country_code>
-    </addressparts>   
+    </addressparts>
   </reversegeocode>
 ```
 
@@ -146,7 +146,7 @@ This overrides the specified machine readable format. (Default: 0)
 ```json
 {
   "place_id":"134140761",
-  "licence":"Data Â© OpenStreetMap contributors, ODbL 1.0. http:\/\/www.openstreetmap.org\/copyright",
+  "licence":"Data Â© OpenStreetMap contributors, ODbL 1.0. https:\/\/www.openstreetmap.org\/copyright",
   "osm_type":"way",
   "osm_id":"280940520",
 "lat":"-34.4391708",
index 4b9d773c485dd4869b430b593a9b85487adf6ddb..4a35e62af827757cd63e8adc3cc313d1fc4c202b 100644 (file)
@@ -1,6 +1,6 @@
 # Search queries
 
-The search API allows to look up a location from a textual description.
+The search API allows you to look up a location from a textual description.
 Nominatim supports structured as well as free-form search queries.
 
 The search query may also contain
@@ -46,7 +46,7 @@ In this form, the query may be given through two different sets of parameters:
     Structured requests are faster but are less robust against alternative
     OSM tagging schemas. **Do not combine with** `q=<query>` **parameter**.
 
-All three query forms accept the additional paramters listed below.
+All three query forms accept the additional parameters listed below.
 
 ### Output format
 
@@ -56,7 +56,7 @@ See [Place Output Formats](Output.md) for details on each format. (Default: html
 
 * `json_callback=<string>`
 
-Wrap json output in a callback function ([JSONP](https://en.wikipedia.org/wiki/JSONP)) i.e. `<string>(<json>)`.
+Wrap JSON output in a callback function ([JSONP](https://en.wikipedia.org/wiki/JSONP)) i.e. `<string>(<json>)`.
 Only has an effect for JSON output formats.
 
 ### Output details
@@ -175,12 +175,12 @@ This overrides the specified machine readable format. (Default: 0)
 
 ```xml
   <searchresults timestamp="Sat, 07 Nov 09 14:42:10 +0000" querystring="135 pilkington, avenue birmingham" polygon="true">
-    <place 
-      place_id="1620612" osm_type="node" osm_id="452010817" 
-      boundingbox="52.548641204834,52.5488433837891,-1.81612110137939,-1.81592094898224" 
-      polygonpoints="[['-1.81592098644987','52.5487429714954'],['-1.81592290792183','52.5487234624632'],...]" 
-      lat="52.5487429714954" lon="-1.81602098644987" 
-      display_name="135, Pilkington Avenue, Wylde Green, City of Birmingham, West Midlands (county), B72, United Kingdom" 
+    <place
+      place_id="1620612" osm_type="node" osm_id="452010817"
+      boundingbox="52.548641204834,52.5488433837891,-1.81612110137939,-1.81592094898224"
+      polygonpoints="[['-1.81592098644987','52.5487429714954'],['-1.81592290792183','52.5487234624632'],...]"
+      lat="52.5487429714954" lon="-1.81602098644987"
+      display_name="135, Pilkington Avenue, Wylde Green, City of Birmingham, West Midlands (county), B72, United Kingdom"
       class="place" type="house">
       <house_number>135</house_number>
       <road>Pilkington Avenue</road>
index e733c6fdedcf93c21f4761d389be352086883884..5a323d2680fbb497b478a0135c3e1ac67a6b588b 100644 (file)
@@ -24,7 +24,7 @@ with multiple tags that may constitute a principal tag. Take for example a
 motorway bridge. In OSM, this would be a way which is tagged with
 `highway=motorway` and `bridge=yes`. This way would appear in the `place` table
 once with `class` of `highway` and once with a `class` of `bridge`. Thus the
-*uique key* for `place` is (`osm_type`, `osm_id`, `class`).
+*unique key* for `place` is (`osm_type`, `osm_id`, `class`).
 
 ## Configuring the Import
 
@@ -55,8 +55,8 @@ suffix match can be defined similarly with a string that starts with a `*`. Any
 other string constitutes an exact match.
 
 The second part of the rules defines a list of values and the properties that
-apply to a successful match. Value strings may be either empty, which again
-means that thy match against any value, or describe an exact match. Prefix
+apply to a successful match. Value strings may be either empty, which
+means that they match any value, or describe an exact match. Prefix
 or suffix matching of values is not possible.
 
 For a rule to match, it has to find a valid combination of keys and values. The
@@ -66,7 +66,7 @@ The rules in a configuration file are processed sequentially and the first
 match for each tag wins.
 
 A rule where key and value are the empty string is special. This defines the
-fallback when none of the rules matches. The fallback is always used as a last
+fallback when none of the rules match. The fallback is always used as a last
 resort when nothing else matches, no matter where the rule appears in the file.
 Defining multiple fallback rules is not allowed. What happens in this case,
 is undefined.
@@ -121,17 +121,17 @@ One or more of the following properties may be given for each tag:
 
 * `address`
 
-    At tag to the list of address tags. If the tag starts with `addr:` or
+    Add tag to the list of address tags. If the tag starts with `addr:` or
     `is_in:`, then this prefix is cut off before adding it to the list.
 
 * `postcode`
 
-    At the value as a postcode to the address tags. If multiple tags are
+    Add the value as a postcode to the address tags. If multiple tags are
     candidate for postcodes, one wins out and the others are dropped.
 
 * `country`
 
-    At the value as a country code to the address tags. The value must be a
+    Add the value as a country code to the address tags. The value must be a
     two letter country code, otherwise it is ignored. If there are multiple
     tags that match, then one wins out and the others are dropped.
 
index 037049373662e72d94d7178595f62cb1c208ced0..776de8f571d6387bd74004864ebeb13628bc47dc 100644 (file)
@@ -21,7 +21,7 @@ Usually only administrative boundaries and place nodes and areas are
 eligible to be part of an address. All other objects have an address rank
 of 0.
 
-Note that the search rank of a place place a role in the address computation
+Note that the search rank of a place plays a role in the address computation
 as well. When collecting the places that should make up the address parts
 then only places are taken into account that have a lower address rank than
 the search rank of the base object.
@@ -37,7 +37,7 @@ into the database. There are a few hard-coded rules for the assignment:
     * highway nodes
     * landuse that is not an area
 
-Other than that, the ranks can be freely assigned via the json file
+Other than that, the ranks can be freely assigned via the JSON file
 defined with `CONST_Address_Level_Config` according to their type and
 the country they are in.
 
@@ -78,12 +78,13 @@ definition is used as a fallback, when nothing more specific for a given
 country exists.
 
 `tags` contains the ranks for key/value pairs. The ranks can be either a
-single number, in which case they are to search and address rank, or a tuple
+single number, in which case they are the search and address rank, or an array
 of search and address rank (in that order). The value may be left empty.
 Then the rank is used when no more specific value is found for the given
 key.
 
-Countries and key/value combination may appear in multiple defintions. Just
+Countries and key/value combination may appear in multiple definitions. Just
 make sure that each combination of counrty/key/value appears only once per
 file. Otherwise the import will fail with a UNIQUE INDEX constraint violation
 on import.
+
index 179eeb0b6328f8333037700c689d5ba577501e45..c0a37a41dd8b54e296e33476d6576dd8571b519e 100644 (file)
@@ -1,6 +1,6 @@
 # Basic Architecture
 
-Nominatim provides geocoding based on OpenStreetMap data. It uses a Postgresql
+Nominatim provides geocoding based on OpenStreetMap data. It uses a PostgreSQL
 database as a backend for storing the data.
 
 There are three basic parts to Nominatim's architecture: the data import,
@@ -15,10 +15,10 @@ the import can be found in the database table `place`.
 The __address computation__ or __indexing__ stage takes the data from `place`
 and adds additional information needed for geocoding. It ranks the places by
 importance, links objects that belong together and computes addresses and
-the search index. Most of this work is done in Pl/pqSQL via database triggers
+the search index. Most of this work is done in PL/pgSQL via database triggers
 and can be found in the file `sql/functions.sql`.
 
-The __search frontend__ implements the actual API. It takes queries for
-search and reverse geocoding queries from the user, looks up the data and
+The __search frontend__ implements the actual API. It takes search
+and reverse geocoding queries from the user, looks up the data and
 returns the results in the requested format. This part is written in PHP
 and can be found in the `lib/` and `website/` directories.
index 67fb52d1a687d654c87255f4c61371b16b994979..23c15ba81b3b3dc0253c0d26fc88cc2a282b8dc8 100644 (file)
@@ -21,6 +21,7 @@ function exception_handler_html($exception)
     http_response_code($exception->getCode());
     header('Content-type: text/html; charset=UTF-8');
     include(CONST_BasePath.'/lib/template/error-html.php');
+    exit();
 }
 
 function exception_handler_json($exception)
@@ -28,6 +29,7 @@ function exception_handler_json($exception)
     http_response_code($exception->getCode());
     header('Content-type: application/json; charset=utf-8');
     include(CONST_BasePath.'/lib/template/error-json.php');
+    exit();
 }
 
 function exception_handler_xml($exception)
@@ -36,17 +38,51 @@ function exception_handler_xml($exception)
     header('Content-type: text/xml; charset=utf-8');
     echo '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
     include(CONST_BasePath.'/lib/template/error-xml.php');
+    exit();
 }
 
+function shutdown_exception_handler_html()
+{
+    $error = error_get_last();
+    if ($error !== null && $error['type'] === E_ERROR) {
+        exception_handler_html(new Exception($error['message'], 500));
+    }
+}
+
+function shutdown_exception_handler_xml()
+{
+    $error = error_get_last();
+    if ($error !== null && $error['type'] === E_ERROR) {
+        exception_handler_xml(new Exception($error['message'], 500));
+    }
+}
 
-function set_exception_handler_by_format($sFormat = 'html')
+function shutdown_exception_handler_json()
 {
-    if ($sFormat == 'html') {
+    $error = error_get_last();
+    if ($error !== null && $error['type'] === E_ERROR) {
+        exception_handler_json(new Exception($error['message'], 500));
+    }
+}
+
+
+function set_exception_handler_by_format($sFormat = null)
+{
+    // Multiple calls to register_shutdown_function will cause multiple callbacks
+    // to be executed, we only want the last executed. Thus we don't want to register
+    // one by default without an explicit $sFormat set.
+
+    if (!isset($sFormat)) {
+        set_exception_handler('exception_handler_html');
+    } elseif ($sFormat == 'html') {
         set_exception_handler('exception_handler_html');
+        register_shutdown_function('shutdown_exception_handler_html');
     } elseif ($sFormat == 'xml') {
         set_exception_handler('exception_handler_xml');
+        register_shutdown_function('shutdown_exception_handler_xml');
     } else {
         set_exception_handler('exception_handler_json');
+        register_shutdown_function('shutdown_exception_handler_json');
     }
 }
 // set a default
index d3f59296a23d35a91128ed7e0d083e6ded444fd4..1447e383d7c81142c4c00c7f3b96effcc80f2fb7 100755 (executable)
@@ -106,34 +106,19 @@ class SetupFunctions
         $fPostgresVersion = $this->oDB->getPostgresVersion();
         echo 'Postgres version found: '.$fPostgresVersion."\n";
 
-        if ($fPostgresVersion < 9.01) {
-            fail('Minimum supported version of Postgresql is 9.1.');
+        if ($fPostgresVersion < 9.03) {
+            fail('Minimum supported version of Postgresql is 9.3.');
         }
 
         $this->pgsqlRunScript('CREATE EXTENSION IF NOT EXISTS hstore');
         $this->pgsqlRunScript('CREATE EXTENSION IF NOT EXISTS postgis');
 
-        // For extratags and namedetails the hstore_to_json converter is
-        // needed which is only available from Postgresql 9.3+. For older
-        // versions add a dummy function that returns nothing.
-        $iNumFunc = $this->oDB->getOne("select count(*) from pg_proc where proname = 'hstore_to_json'");
-
-        if ($iNumFunc == 0) {
-            $this->pgsqlRunScript("create function hstore_to_json(dummy hstore) returns text AS 'select null::text' language sql immutable");
-            warn('Postgresql is too old. extratags and namedetails API not available.');
-        }
-
-
         $fPostgisVersion = $this->oDB->getPostgisVersion();
         echo 'Postgis version found: '.$fPostgisVersion."\n";
 
-        if ($fPostgisVersion < 2.1) {
-            // Functions were renamed in 2.1 and throw an annoying deprecation warning
-            $this->pgsqlRunScript('ALTER FUNCTION st_line_interpolate_point(geometry, double precision) RENAME TO ST_LineInterpolatePoint');
-            $this->pgsqlRunScript('ALTER FUNCTION ST_Line_Locate_Point(geometry, geometry) RENAME TO ST_LineLocatePoint');
-        }
         if ($fPostgisVersion < 2.2) {
-            $this->pgsqlRunScript('ALTER FUNCTION ST_Distance_Spheroid(geometry, geometry, spheroid) RENAME TO ST_DistanceSpheroid');
+            echo "Minimum required Postgis version 2.2\n";
+            exit(1);
         }
 
         $i = $this->oDB->getOne("select count(*) from pg_user where usename = '".CONST_Database_Web_User."'");
index 56c8f56b43e1464361d535eeb61e2335d1d983e4..90e17f0e8c793487ca39cbf95501cd9c5daa33e2 160000 (submodule)
--- a/osm2pgsql
+++ b/osm2pgsql
@@ -1 +1 @@
-Subproject commit 56c8f56b43e1464361d535eeb61e2335d1d983e4
+Subproject commit 90e17f0e8c793487ca39cbf95501cd9c5daa33e2
index d42d9fca36a9e9030856340df0655798c8981490..75ccfd689669dcf7c1673dd9ad8beee7f1c7d216 100644 (file)
@@ -1162,6 +1162,7 @@ TRIGGER
 DECLARE
 
   place_centroid GEOMETRY;
+  near_centroid GEOMETRY;
 
   search_maxdistance FLOAT[];
   search_mindistance FLOAT[];
@@ -1266,6 +1267,8 @@ BEGIN
   -- Speed up searches - just use the centroid of the feature
   -- cheaper but less acurate
   place_centroid := ST_PointOnSurface(NEW.geometry);
+  -- For searching near features rather use the centroid
+  near_centroid := ST_Centroid(NEW.geometry);
   NEW.centroid := null;
   NEW.postcode := null;
   --DEBUG: RAISE WARNING 'Computing preliminary centroid at %',ST_AsText(place_centroid);
@@ -1396,7 +1399,7 @@ BEGIN
     IF NEW.parent_place_id IS NULL AND addr_street IS NOT NULL THEN
       address_street_word_ids := get_name_ids(make_standard_name(addr_street));
       IF address_street_word_ids IS NOT NULL THEN
-        SELECT place_id from getNearestNamedRoadFeature(NEW.partition, place_centroid, address_street_word_ids) INTO NEW.parent_place_id;
+        SELECT place_id from getNearestNamedRoadFeature(NEW.partition, near_centroid, address_street_word_ids) INTO NEW.parent_place_id;
       END IF;
     END IF;
     --DEBUG: RAISE WARNING 'Checked for addr:street (%)', NEW.parent_place_id;
@@ -1404,7 +1407,7 @@ BEGIN
     IF NEW.parent_place_id IS NULL AND addr_place IS NOT NULL THEN
       address_street_word_ids := get_name_ids(make_standard_name(addr_place));
       IF address_street_word_ids IS NOT NULL THEN
-        SELECT place_id from getNearestNamedPlaceFeature(NEW.partition, place_centroid, address_street_word_ids) INTO NEW.parent_place_id;
+        SELECT place_id from getNearestNamedPlaceFeature(NEW.partition, near_centroid, address_street_word_ids) INTO NEW.parent_place_id;
       END IF;
     END IF;
     --DEBUG: RAISE WARNING 'Checked for addr:place (%)', NEW.parent_place_id;
@@ -1439,7 +1442,7 @@ BEGIN
           IF location.address ? 'street' THEN
             address_street_word_ids := get_name_ids(make_standard_name(location.address->'street'));
             IF address_street_word_ids IS NOT NULL THEN
-              SELECT place_id from getNearestNamedRoadFeature(NEW.partition, place_centroid, address_street_word_ids) INTO NEW.parent_place_id;
+              SELECT place_id from getNearestNamedRoadFeature(NEW.partition, near_centroid, address_street_word_ids) INTO NEW.parent_place_id;
               EXIT WHEN NEW.parent_place_id is not NULL;
             END IF;
           END IF;
@@ -1448,7 +1451,7 @@ BEGIN
           IF location.address ? 'place' THEN
             address_street_word_ids := get_name_ids(make_standard_name(location.address->'place'));
             IF address_street_word_ids IS NOT NULL THEN
-              SELECT place_id from getNearestNamedPlaceFeature(NEW.partition, place_centroid, address_street_word_ids) INTO NEW.parent_place_id;
+              SELECT place_id from getNearestNamedPlaceFeature(NEW.partition, near_centroid, address_street_word_ids) INTO NEW.parent_place_id;
               EXIT WHEN NEW.parent_place_id is not NULL;
             END IF;
           END IF;
@@ -1477,7 +1480,7 @@ BEGIN
 
     -- Still nothing, just use the nearest road
     IF NEW.parent_place_id IS NULL THEN
-      SELECT place_id FROM getNearestRoadFeature(NEW.partition, place_centroid) INTO NEW.parent_place_id;
+      SELECT place_id FROM getNearestRoadFeature(NEW.partition, near_centroid) INTO NEW.parent_place_id;
     END IF;
     --DEBUG: RAISE WARNING 'Checked for nearest way (%)', NEW.parent_place_id;
 
@@ -1500,7 +1503,7 @@ BEGIN
              NEW.postcode := location.postcode;
           END IF;
           IF NEW.postcode is null THEN
-            NEW.postcode := get_nearest_postcode(NEW.country_code, place_centroid);
+            NEW.postcode := get_nearest_postcode(NEW.country_code, near_centroid);
           END IF;
       END IF;
 
@@ -1770,7 +1773,7 @@ BEGIN
                                   CASE WHEN NEW.rank_search >= 26
                                              AND NEW.rank_search < 30
                                        THEN NEW.geometry
-                                       ELSE place_centroid END,
+                                       ELSE near_centroid END,
                                   search_maxrank, isin_tokens)
   LOOP
     IF location.rank_address != location_rank_search THEN
index 1cbc88588aa0cf04ce486cff28ac7387ebf0604b..d59df15b67565cc4061aabba4a34d925f6e8111a 100644 (file)
@@ -6,7 +6,7 @@ SELECT country_code,
        ST_Centroid(ST_Collect(ST_Centroid(geometry))) as centroid
   FROM placex
  WHERE address ? 'postcode'
-       AND address->'postcode' NOT SIMILAR TO '%(,|;)%'
+       AND address->'postcode' NOT SIMILAR TO '%(,|;|:)%'
        AND geometry IS NOT null
 GROUP BY country_code, pc;
 
index 02d0982460a3191291d82cdb8fc7998f8c224c6f..b12b648129f236af53b789a85b1cc74c01285960 100644 (file)
@@ -195,6 +195,7 @@ class NominatimEnvironment(object):
         proc = subprocess.Popen(cmd, cwd=self.build_dir,
                                 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         (outp, outerr) = proc.communicate()
+        outerr = outerr.decode('utf-8').replace('\\n', '\n')
         logger.debug("run_nominatim_script: %s\n%s\n%s" % (cmd, outp, outerr))
         assert (proc.returncode == 0), "Script '%s' failed:\n%s\n%s\n" % (script, outp, outerr)
 
index 766bc7f13c7c404d76397f8e7221263a8c2f5e9a..ea93ea4a01c7aab453b1f0dc4f70c1e0c7c6c9a9 100644 (file)
@@ -96,9 +96,9 @@ Feature: Tag evaluation
         Then place contains
          | object | name |
          | N1     | 'name: de' : 'Foo', 'name' : 'real1' |
-         | N2     | 'name: de' : 'Foo', 'name' : 'real2' |
-         | N3     | 'name: de' : 'Foo', 'name:\\\\' : 'real3' |
-         | N4     | 'name: de' : 'Foo', 'name' : 'rea\\l3' |
+         | N2     | 'name:\nde' : 'Foo', 'name' : 'real2' |
+         | N3     | 'name:\tde' : 'Foo', 'name:\\\\' : 'real3' |
+         | N4     | 'name:\tde' : 'Foo', 'name' : 'rea\\l3' |
 
     Scenario: Unprintable character in address tag are maintained
         When loading osm data
index e8d96d44e3e372733b5abf1247314452d50c0159..072f83fa4e98d4c86a939fa9bfb937cb3b231ebf 100644 (file)
@@ -24,3 +24,38 @@ Feature: Update of simple objects by osm2pgsql
           | object     | class   | type       | name |
           | N1:tourism | tourism | hotel      | 'name' : 'foo' |
 
+    Scenario: Downgrading a highway to one that is dropped without name
+        When loading osm data
+          """
+          n100 x0 y0
+          n101 x0.0001 y0.0001
+          w1 Thighway=residential Nn100,n101
+          """
+        Then place contains
+          | object     |
+          | W1:highway |
+        When updating osm data
+          """
+          w1 Thighway=service Nn100,n101
+          """
+        Then place has no entry for W1
+
+    Scenario: Downgrading a highway when a second tag is present
+        When loading osm data
+          """
+          n100 x0 y0
+          n101 x0.0001 y0.0001
+          w1 Thighway=residential,tourism=hotel Nn100,n101
+          """
+        Then place contains
+          | object     |
+          | W1:highway |
+          | W1:tourism |
+        When updating osm data
+          """
+          w1 Thighway=service,tourism=hotel Nn100,n101
+          """
+        Then place has no entry for W1:highway
+        And place contains
+          | object     |
+          | W1:tourism |
index 49334d44d903ba0eb00e88f87dba8718df6030a9..567149895555bf10aad3ada4550cc067f396e4fc 100755 (executable)
@@ -97,7 +97,7 @@ server {
         if (!-f \$document_root\$fastcgi_script_name) {
             return 404;
         }
-        fastcgi_pass unix:/var/run/php7.2-fpm.sock;
+        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
         fastcgi_index search.php;
         include fastcgi.conf;
     }