Sarah Hoffmann [Wed, 8 Apr 2020 08:04:49 +0000 (10:04 +0200)]
address ranks must not invert admin_level hierarchy
When inheriting an address rank from a linked place we
must be careful not to destroy the hierarchy established
through boundary admin_level. Therefore, before assigning
an address rank from a linked place, find the next higher
boundary in the admin_level hierarchy, look up its address
rank and then only use the address rank from the linked
place if it is higher.
Sarah Hoffmann [Sat, 11 Apr 2020 07:20:13 +0000 (09:20 +0200)]
reset address and search ranks on update
With ranks being dynamically changed through linking of places,
it is important to reset the ranks on update, so that changes
of the rank due to changes in linking are correctly taken into
account.
Sarah Hoffmann [Wed, 1 Apr 2020 09:12:52 +0000 (11:12 +0200)]
determine geocodejson address by rank instead of type
Using the address rank to set the address parts catches
a much wider variety of types like 'town' and 'suburb'.
With recent address ranking changes the rank ranges
are relatively reliable.
Sarah Hoffmann [Sun, 29 Mar 2020 18:49:35 +0000 (20:49 +0200)]
rather use new place_type in getAddressNames()
If for a boundary the place_type is defined, handle the address
part like a place node. This is the same behaviour as before
when class/type where patched earlier.
Sarah Hoffmann [Sun, 29 Mar 2020 15:40:56 +0000 (17:40 +0200)]
Fix address link for boundaries in details
Removes the special casing for boundaries with a place
type in get_addressdata(). Instead the place type is now
returned as an extra field, so that the caller has to
handle the situation.
This fixes the details link next to the address in the details
view, which previously would go to a place class instead of the
original boundary class.
Sarah Hoffmann [Sat, 21 Mar 2020 21:43:28 +0000 (22:43 +0100)]
use wikidata tag for linking places
Having the same wikidata is a strong indicator that the same place
is meant. There are some assignment errors where the wikidata does
not link to the object itself but to something that mentions the
place. To reduce errors there, prefer same name.
Sarah Hoffmann [Sat, 21 Mar 2020 20:59:11 +0000 (21:59 +0100)]
remove linking via admin_centre role
The admin_centre role is for the seat of government which is not
the same as the administrative entity. This is mostly used
correctly these days, so avoid matching by that role.
Sarah Hoffmann [Sat, 21 Mar 2020 20:57:04 +0000 (21:57 +0100)]
linking: better name matching for address-less places
Administrative boundaries that do not figure in the address
should still be able to take part in the name matching.
Use the rank_search for comparison in this case.
Sarah Hoffmann [Wed, 4 Mar 2020 08:59:57 +0000 (09:59 +0100)]
linked centroids must always be within geometry
When using a linked place as centroid for a boundary, check
first that it is really within the area. If it is outside,
just keep the computed centroid because a centroid outside the
area just causes havok.
Sarah Hoffmann [Wed, 26 Feb 2020 09:14:28 +0000 (10:14 +0100)]
simplify getNearestParallelRoadFeature function
The function only ever returns one result of which only the
place_id is used. So simplify it to return a single place_id
only (or NULL if none is found).
Sarah Hoffmann [Wed, 26 Feb 2020 09:04:17 +0000 (10:04 +0100)]
simplify getNearestRoadFeature function
The function only ever returns one result of which only the
place_id is used. So simplify it to return a single place_id
only (or NULL if none is found). Rename funciton to avoid
conflicts when updating an existing database.
Sarah Hoffmann [Wed, 5 Feb 2020 20:33:24 +0000 (21:33 +0100)]
improve parenting for large areas with rank 30
Instead of unconditionally parenting them to a street, the
larger areas get a parent area that contains them. To keep
things computationally light-weight, only use the centroid and
bbox to determine if an area is contained.
Requires renaming of parenting functions because renaming
a parameter of the function causes issues when updating the
function (it requires a manual delete, which I'd like to
avoid).
Sarah Hoffmann [Sun, 16 Feb 2020 13:10:22 +0000 (14:10 +0100)]
add bbox whereclause to make postgis 3.0 happy
Normally ST_Covers() should include a bbox index use,
so adding a bbox where clause is not really necessary.
However, the query planner messes up and uses a parallel
index search with a second index instead of exclusively
running on the geometry index, when the bbox part is
missing.
Sarah Hoffmann [Wed, 12 Feb 2020 10:03:20 +0000 (11:03 +0100)]
clean up intermediate tables earlier with --drop
When --drop is given, we can remove all node geometry information
already after the import with osm2pgsql. Also drop all unnecessary
tables before creating the final indices.
Sarah Hoffmann [Tue, 11 Feb 2020 21:08:04 +0000 (22:08 +0100)]
nominatim.py: use async in connect() function
The _async parameter name is only supported since psycopg 2.7.
However, async is a keyword in Python >= 3.7, so using this
gives us a syntax error. Working around this by defining the
parameters in a dict and handing that into the connect function.