Skip to content

Commit

Permalink
added relation id to geojson (#49)
Browse files Browse the repository at this point in the history
* added relation id to geojson output
  • Loading branch information
AndGem authored Sep 28, 2024
1 parent 6df01ad commit 1c9c316
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/branch-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
run: |
target/debug/osm_extract_polygon -f data/suriname-latest.osm.pbf -g
echo $(md5sum data/suriname-latest.osm.pbf_polygons/Papaichton.geojson)
md5sum data/suriname-latest.osm.pbf_polygons/Papaichton.geojson | cut -c1-32 | awk '$1!="6554ec55b2f7a05cacb8fbe0df3199f2" {err = 1; exit; } END {exit err}'
md5sum data/suriname-latest.osm.pbf_polygons/Papaichton.geojson | cut -c1-32 | awk '$1!="0dfccf437c98e4f22988466064589ca7" {err = 1; exit; } END {exit err}'
md5sum data/suriname-latest.osm.pbf_polygons/Papaichton.poly | cut -c1-32 | awk '$1!="f017f2ca29051e1c9dea687a11f6175e" {err = 1; exit; } END {exit err}'
echo $(md5sum data/suriname-latest.osm.pbf_polygons/Maripasoula.geojson)
md5sum data/suriname-latest.osm.pbf_polygons/Maripasoula.geojson | cut -c1-32 | awk '$1!="934f4d585799776d2f10ef608ad2103f" {err = 1; exit; } END {exit err}'
md5sum data/suriname-latest.osm.pbf_polygons/Maripasoula.geojson | cut -c1-32 | awk '$1!="1837993d9e7ca6b16c6fa136a7a98537" {err = 1; exit; } END {exit err}'
md5sum data/suriname-latest.osm.pbf_polygons/Maripasoula.poly | cut -c1-32 | awk '$1!="d7608f4bd631237a092b9a5777091340" {err = 1; exit; } END {exit err}'
- name: Push to codecov.io
env:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "osm_extract_polygon"
version = "0.5.6"
version = "0.5.7"
authors = ["Andreas <[email protected]>"]
edition = "2018"

Expand Down
3 changes: 1 addition & 2 deletions src/osm_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use osmpbfreader::{Node, NodeId, OsmPbfReader, Relation, RelationId, WayId};

use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::i8::MAX;
use std::path::Path;
use std::time::Instant;

Expand Down Expand Up @@ -48,7 +47,7 @@ fn has_proper_admin_level(relation: &Relation, min_admin: &i8, max_admin: &i8) -
.tags
.get("admin_level")
.and_then(|v| v.parse::<i8>().ok())
.unwrap_or(MAX);
.unwrap_or(i8::MAX);

(*min_admin <= admin_level) && (admin_level <= *max_admin)
}
Expand Down
1 change: 1 addition & 0 deletions src/output/file_writer_geojson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ fn create_properties(polygon: &Polygon) -> Map<String, serde_json::Value> {
let mut properties = Map::new();
properties.insert(String::from("name"), to_value(&polygon.name).unwrap());
properties.insert(String::from("admin_level"), to_value(polygon.admin_level).unwrap());
properties.insert(String::from("relation_id"), to_value(polygon.relation_id).unwrap());
properties
}

Expand Down

0 comments on commit 1c9c316

Please sign in to comment.