@@ -16,6 +16,7 @@ pub struct MapModel {
16
16
pub intersections : Vec < Intersection > ,
17
17
// All geometry stored in worldspace, including rtrees
18
18
pub mercator : Mercator ,
19
+ pub study_area_name : Option < String > ,
19
20
pub boundary_polygon : Polygon ,
20
21
21
22
// TODO Wasteful, can share some
@@ -67,8 +68,8 @@ pub struct Intersection {
67
68
68
69
impl MapModel {
69
70
/// Call with bytes of an osm.pbf or osm.xml string
70
- pub fn new ( input_bytes : & [ u8 ] ) -> Result < MapModel > {
71
- crate :: scrape:: scrape_osm ( input_bytes)
71
+ pub fn new ( input_bytes : & [ u8 ] , study_area_name : Option < String > ) -> Result < MapModel > {
72
+ crate :: scrape:: scrape_osm ( input_bytes, study_area_name )
72
73
}
73
74
74
75
pub fn get_r ( & self , r : RoadID ) -> & Road {
@@ -241,6 +242,22 @@ impl MapModel {
241
242
f. remove_property ( "road" ) ;
242
243
}
243
244
gj. features . extend ( self . boundaries . values ( ) . cloned ( ) ) ;
245
+
246
+ let mut f = Feature :: from ( Geometry :: from (
247
+ & self . mercator . to_wgs84 ( & self . boundary_polygon ) ,
248
+ ) ) ;
249
+ f. set_property ( "kind" , "study_area_boundary" ) ;
250
+ gj. features . push ( f) ;
251
+
252
+ gj. foreign_members = Some (
253
+ serde_json:: json!( {
254
+ "study_area_name" : self . study_area_name,
255
+ } )
256
+ . as_object ( )
257
+ . unwrap ( )
258
+ . clone ( ) ,
259
+ ) ;
260
+
244
261
gj
245
262
}
246
263
0 commit comments