Support recursive relations when reconstructing geometries
- Dominant language
- Scala
- Stars
- 81
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
Certain types of relations include other relations as members, [3D Buildings](https://wiki.openstreetmap.org/wiki/Simple_3D_buildings), for example (for outlines). In order to reconstruct these, members must already have been reconstructed.
Examples of such relations can be found using this Presto query, which will reveal the type of relation _containing_ relations:
```sql
select
id,
tags['type'] type,
filter(members, x -> x.type = 'relation') relation_members
from planet_history
where cardinality(filter(members, x -> x.type = 'relation')) > 0
and type = 'relation'
```
This Presto query will show the type (and quantity) of relation _members_:
```sql
SELECT tags['type'], count(*)
FROM planet_history
WHERE type = 'relation'
AND id IN (
SELECT ref
FROM planet_history
CROSS JOIN unnest(transform(filter(members, x -> x.type = 'relation'), x -> x.ref)) AS t (ref)
WHERE cardinality(filter(members, x -> x.type = 'relation')) > 0
AND type = 'relation'
)
GROUP BY tags['type']
ORDER BY count(*) DESC
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the geometry reconstruction path and how relation members are loaded before a parent relation is reconstructed. Use the supplied Presto queries to identify nested-relation examples, then verify that recursive members are reconstructed first and the resulting geometries match the expected outlines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala, spark, sql
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100