Skip to content

Commit

Permalink
Merge pull request #157 from osm-without-borders/add_suburb_node
Browse files Browse the repository at this point in the history
add suburb node
  • Loading branch information
sdrll authored Jul 17, 2023
2 parents 611f260 + 9d299bb commit 04b7c71
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Test and Publish crate

on: [push, pull_request]
on: [pull_request]

jobs:
tests:
Expand All @@ -23,7 +23,6 @@ jobs:
components: rustfmt

- run: cargo fmt --all -- --check
- run: cargo test --all
- run: cd cosmogony && cargo test --all

- name: Publish crate
Expand Down
9 changes: 8 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub fn get_zones_and_stats(
let mut zones = Vec::with_capacity(1000);

for obj in pbf.values() {
if !is_admin(obj) {
if !is_admin(obj) && !obj.tags().get("place").map_or(false, |v| v == "suburb") {
continue;
}
if let OsmObj::Relation(ref relation) = *obj {
Expand All @@ -70,6 +70,13 @@ pub fn get_zones_and_stats(
}
};
}
if let OsmObj::Node(ref node) = *obj {
let next_index = ZoneIndex { index: zones.len() };
if let Some(zone) = Zone::from_osm_node(node, next_index) {
// Ignore zone without boundary polygon for the moment
zones.push(zone);
};
}
}

Ok((zones, stats))
Expand Down

0 comments on commit 04b7c71

Please sign in to comment.