Skip to content

Commit

Permalink
Upgrade route-snapper
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Mar 1, 2024
1 parent d99feba commit 8422a1d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion backend/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 backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ geo = { git = "https://github.com/dabreegster/geo", branch = "boolops_and_linesp
geojson = { git = "https://github.com/georust/geojson", features = ["geo-types"] }
log = "0.4.20"
osm-reader = { git = "https://github.com/a-b-street/osm-reader" }
route-snapper-graph = { git = "https://github.com/dabreegster/route_snapper", branch = "no_osm2streets" }
route-snapper-graph = { git = "https://github.com/dabreegster/route_snapper" }
serde = "1.0.188"
serde_json = "1.0.105"
serde-wasm-bindgen = "0.6.0"
Expand Down
17 changes: 14 additions & 3 deletions backend/src/route_snapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ impl MapModel {
node1: NodeID(r.src_i.0 as u32),
node2: NodeID(r.dst_i.0 as u32),
geometry: self.mercator.to_wgs84(&r.linestring),
name: r.tags.get("name").cloned(),

// Isn't serialized, doesn't matter
length_meters: 0.0,
name: r.tags.get("name").cloned(),
forward_cost: None,
backward_cost: None,
});
}

Expand Down Expand Up @@ -89,9 +92,12 @@ impl MapModel {
node1: pt_to_node_id[&hashify_point(split_ls.0[0])],
node2: pt_to_node_id[&hashify_point(*split_ls.0.last().unwrap())],
geometry: self.mercator.to_wgs84(&split_ls),
name: self.get_r(r).tags.get("name").cloned(),

// Isn't serialized, doesn't matter
length_meters: 0.0,
name: self.get_r(r).tags.get("name").cloned(),
forward_cost: None,
backward_cost: None,
});
}

Expand All @@ -105,7 +111,12 @@ impl MapModel {
edges.remove(r.0);
}

RouteSnapperMap { nodes, edges }
RouteSnapperMap {
nodes,
edges,
override_forward_costs: Vec::new(),
override_backward_costs: Vec::new(),
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions web/package-lock.json

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

2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@maptiler/geocoding-control": "^1.2.2",
"@picocss/pico": "^2.0.3",
"@turf/nearest-point-on-line": "^6.5.0",
"route-snapper": "0.3.0",
"route-snapper": "^0.4.0",
"svelte-maplibre": "^0.8.1"
}
}

0 comments on commit 8422a1d

Please sign in to comment.