Commit Graph

25 Commits

Author SHA1 Message Date
Sarah Hoffmann
f5f0c197be move ranks-related functions in separate sql file
Also adds a common function for computing the update radius
around place nodes.
2020-04-10 11:34:14 +02:00
Sarah Hoffmann
4a30ec28b9 move helper functions from placex_triggers into utils
Also adds documentation for these functions.
2020-04-10 11:05:11 +02:00
Sarah Hoffmann
81c7f618fb avoid deletes on search_name in reverse-only mode 2020-04-04 18:26:27 +02:00
Sarah Hoffmann
e26a300c2f 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.
2020-03-21 22:46:54 +01:00
Sarah Hoffmann
405482ede4 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.
2020-03-21 21:59:11 +01:00
Sarah Hoffmann
3db2b05069 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.
2020-03-21 21:57:04 +01:00
Sarah Hoffmann
1f7394dd54 place node address parts must be in lower rank area
This fixes a regression where the area of the lower ranking
area was not computed correctly.

Also excludes postcodes areas now as they have their own
hierarchy.
2020-03-06 21:51:38 +01:00
Sarah Hoffmann
78526a33b4 Remove linkees from search_name
Fixes #722
2020-03-04 11:36:39 +01:00
Sarah Hoffmann
6d431aebb7 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.

Fixes #1352.
2020-03-04 09:59:57 +01:00
Sarah Hoffmann
acd8ca2ebd add testing for rank adaption while linking 2020-02-28 15:22:48 +01:00
Sarah Hoffmann
06fdfad89e link against place nodes by place type
If a boundary relation has no label member preferably
link against a place node with the same place type.

Also inherit the rank_address from the place node (only
has an effect when linking via lable member or place type).
2020-02-28 15:22:48 +01:00
Sarah Hoffmann
00ca493f33 move linked place type into linked_place extratags
Using linked_place means that we don't overwrite any
place tags on the boundary. This is important when we
wanto to use the information for linking.
2020-02-28 15:22:48 +01:00
Sarah Hoffmann
84ea0753d8 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.
2020-02-26 10:58:55 +01:00
Sarah Hoffmann
d643ca8dee move address line computation in its own function 2020-02-21 16:38:14 +01:00
Sarah Hoffmann
6189e0c79b 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).
2020-02-19 08:43:53 +01:00
Sarah Hoffmann
92c5d3b720 make sure that linked places are within a boundary
This is a regression from previous code refactoring.

Fixes #1684.
2020-02-18 22:46:32 +01:00
Sarah Hoffmann
2a6e8ad68e 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.
2020-02-16 14:10:22 +01:00
Sarah Hoffmann
6f6d116451 adapt index for changes name lookup 2020-01-23 22:28:43 +01:00
Sarah Hoffmann
5d1fa597ea clean up get_word_id function
Replaced by addr_ids_from_name() which also normalises the
string.
2020-01-23 22:28:43 +01:00
Sarah Hoffmann
f863040b38 factor out parent search from addr:street/addr:place 2020-01-23 22:28:43 +01:00
Sarah Hoffmann
1033f8bce7 factor out searching for parent road for pois 2020-01-23 22:28:43 +01:00
Sarah Hoffmann
6dccc693d0 factor out computation of default names
Also moves the computation down the line so that we never
have to do it twice.
2020-01-23 22:28:43 +01:00
Sarah Hoffmann
c3dc66ce9c factor out place linking sql 2020-01-23 22:28:43 +01:00
Sarah Hoffmann
ddaf1b79d4 remove special handling of rail
Skip railway=rail in the style, so that installations can remove
it if they wish.
2020-01-08 23:53:23 +01:00
Sarah Hoffmann
dae2761137 move placex triggers into own file 2020-01-08 11:18:42 +01:00