@@ -6,7 +6,7 @@ use geo::{
6
6
Closest , ClosestPoint , Coord , Euclidean , Length , Line , LineInterpolatePoint , LineLocatePoint ,
7
7
LineString , Point , Polygon ,
8
8
} ;
9
- use geojson:: { Feature , FeatureCollection , GeoJson , Geometry } ;
9
+ use geojson:: { Feature , FeatureCollection , GeoJson } ;
10
10
use serde:: Serialize ;
11
11
use utils:: { Mercator , Tags } ;
12
12
@@ -284,7 +284,7 @@ impl MapModel {
284
284
. linestring
285
285
. line_interpolate_point ( filter. percent_along )
286
286
. unwrap ( ) ;
287
- let mut f = Feature :: from ( Geometry :: from ( & self . mercator . to_wgs84 ( & pt) ) ) ;
287
+ let mut f = self . mercator . to_wgs84_gj ( & pt) ;
288
288
f. set_property ( "filter_kind" , filter. kind . to_string ( ) ) ;
289
289
f. set_property ( "road" , r. 0 ) ;
290
290
f. set_property ( "edited" , Some ( filter) != self . original_modal_filters . get ( r) ) ;
@@ -317,15 +317,15 @@ impl MapModel {
317
317
. linestring
318
318
. line_interpolate_point ( filter. percent_along )
319
319
. unwrap ( ) ;
320
- let mut f = Feature :: from ( Geometry :: from ( & self . mercator . to_wgs84 ( & pt) ) ) ;
320
+ let mut f = self . mercator . to_wgs84_gj ( & pt) ;
321
321
f. set_property ( "kind" , "deleted_existing_modal_filter" ) ;
322
322
gj. features . push ( f) ;
323
323
}
324
324
325
325
// Any direction edits
326
326
for r in & self . roads {
327
327
if self . directions [ & r. id ] != Direction :: from_osm ( & r. tags ) {
328
- let mut f = Feature :: from ( Geometry :: from ( & self . mercator . to_wgs84 ( & r. linestring ) ) ) ;
328
+ let mut f = self . mercator . to_wgs84_gj ( & r. linestring ) ;
329
329
f. set_property ( "kind" , "direction" ) ;
330
330
f. set_property ( "direction" , self . directions [ & r. id ] . to_string ( ) ) ;
331
331
gj. features . push ( f) ;
@@ -334,9 +334,7 @@ impl MapModel {
334
334
335
335
gj. features . extend ( self . boundaries . values ( ) . cloned ( ) ) ;
336
336
337
- let mut f = Feature :: from ( Geometry :: from (
338
- & self . mercator . to_wgs84 ( & self . boundary_polygon ) ,
339
- ) ) ;
337
+ let mut f = self . mercator . to_wgs84_gj ( & self . boundary_polygon ) ;
340
338
f. set_property ( "kind" , "study_area_boundary" ) ;
341
339
gj. features . push ( f) ;
342
340
@@ -454,12 +452,12 @@ impl MapModel {
454
452
. unwrap ( )
455
453
. route ( self , pt1, pt2)
456
454
{
457
- let mut f = Feature :: from ( Geometry :: from ( & self . mercator . to_wgs84 ( & linestring) ) ) ;
455
+ let mut f = self . mercator . to_wgs84_gj ( & linestring) ;
458
456
f. set_property ( "kind" , "before" ) ;
459
457
features. push ( f) ;
460
458
}
461
459
if let Some ( linestring) = self . router_current . as_ref ( ) . unwrap ( ) . route ( self , pt1, pt2) {
462
- let mut f = Feature :: from ( Geometry :: from ( & self . mercator . to_wgs84 ( & linestring) ) ) ;
460
+ let mut f = self . mercator . to_wgs84_gj ( & linestring) ;
463
461
f. set_property ( "kind" , "after" ) ;
464
462
features. push ( f) ;
465
463
}
@@ -496,7 +494,7 @@ impl Road {
496
494
}
497
495
498
496
pub fn to_gj ( & self , mercator : & Mercator ) -> Feature {
499
- let mut f = Feature :: from ( Geometry :: from ( & mercator. to_wgs84 ( & self . linestring ) ) ) ;
497
+ let mut f = mercator. to_wgs84_gj ( & self . linestring ) ;
500
498
f. set_property ( "id" , self . id . 0 ) ;
501
499
f. set_property ( "way" , self . way . to_string ( ) ) ;
502
500
f. set_property ( "node1" , self . node1 . to_string ( ) ) ;
0 commit comments