fix superseded parent IDs - #23
Conversation
|
I spotted an error in https://github.com/whosonfirst-data/whosonfirst-data-admin-ca/pull/23/files#diff-322a3e7cd45c1904f9bca3e39dae55f9 In that case it seems as though the |
|
Okay, I fixed the bug mentioned above with pelias/wof#21 and added e3bb499. Let me know if you'd like to to squash the commits before merge? I thought it's nicer to have two for the review 😄 |
…self-references in the hierarchy
|
Caught one more (fairly rare) bug, fixed in pelias/wof#22, added 505cc0e |
| "mz:hierarchy_label":1, | ||
| "mz:is_current":1, | ||
| "mz:min_zoom":13.0, | ||
| "mz:min_zoom":13, |
There was a problem hiding this comment.
Our zoom values should remain floats (13.0, rather than 13).
There was a problem hiding this comment.
The docs were run through 'exportify' so I don't have any control over how they are serialised 🤷
| "continent_id":102191575, | ||
| "country_id":85633041, | ||
| "county_id":890456343, | ||
| "locality_id":101740755, |
There was a problem hiding this comment.
So, in this case, the record currently has a dual hierarchy, but only one of the hierarchies is valid.. we should remove this entire hierarchy set so this feature only has one hierarchy (the one below, with "locality_id":101735893).
There was a problem hiding this comment.
How do I detect an valid/invalid hierarchy?
There was a problem hiding this comment.
I added a56eabe which I think is the correct fix.
// deduplicate hierarchies
// remove any hierarchies which are duplicates of, or a subset of another hierarchy
const deduplicatedHierarchies = hierarchies.filter((h1, b1) => {
return !hierarchies.some((h2, b2) => (b1 != b2) && _.isMatch(h2, h1))
})[edit] this deduplication algo was improved further and tested in pelias/wof#25
| "lbl:latitude":43.676352, | ||
| "lbl:longitude":-79.628342, | ||
| "lbl:max_zoom":18.0, | ||
| "lbl:max_zoom":18, |
There was a problem hiding this comment.
Same goes for lbl zooms, let's keep them float values (18.0, rather than 18).
| "edtf:inception":"uuuu", | ||
| "geom:area":0.0, | ||
| "geom:area_square_m":0.0, | ||
| "geom:area_square_m":0, |
There was a problem hiding this comment.
this is the command I'm using to run exportify in docker:
https://github.com/pelias/wof/blob/master/whosonfirst/exportify.js
There was a problem hiding this comment.
I'm a bit confuddled by this, why was geom:area_square_m converted to 0 but the line above geom:area remained 0.0 😕
|
opened an issue over at exportify whosonfirst/py-mapzen-whosonfirst-export#28 |


This PR fixes the superseded parent IDs as discussed in whosonfirst-data/whosonfirst-data#1377
I produced these changes with the following commands:
The actual 'fix' code itself lives in https://github.com/pelias/wof/blob/master/sqlite/fix.js
A brief summary of how the
wof sqlite fixcommand works:wof:supersedesset to a non-empty arraymz:is_current=04.1 Update
wof:parent_idif in replacement map4.2 Update hierarchies, any self-references are skipped
I can go ahead and open PRs for all the other repos too, but using CA first as a testcase.
Once we discuss/merge this I'll use the same process for the others which should make the review/merge process easier.
I'm pretty comfortable with this workflow, so hopefully it's only the first of many machine generated PRs from me 🤖