1use mapplot::google::{style::Color, Circle, GoogleMap, Marker, Polygon, Polyline, Rectangle};
2use std::fs;
3
4fn main() {
5 let netherlands = [
6 (53.3224787, 7.1852322),
7 (53.0056055, 7.1962228),
8 (52.6438557, 7.0463535),
9 (52.6447300, 6.7291260),
10 (52.4812789, 6.6894452),
11 (52.4342406, 7.0236950),
12 (52.2424500, 7.0470565),
13 (52.0470369, 6.6932297),
14 (51.9830783, 6.8290338),
15 (51.8964998, 6.7298075),
16 (51.8259113, 5.9564802),
17 (51.3774719, 6.2276121),
18 (51.0097412, 5.8965660),
19 (50.9158272, 6.0903844),
20 (50.7539195, 6.0194753),
21 (50.7542591, 5.6965799),
22 (50.8729117, 5.6644788),
23 (51.1726854, 5.8394065),
24 (51.2601708, 5.2948931),
25 (51.4591271, 5.0513089),
26 (51.4187846, 4.3904119),
27 (51.2176932, 3.8900991),
28 (51.3706174, 3.3641251),
29 ];
30
31 let switzerland = [
32 (47.5976076, 8.1243554),
33 (47.4744889, 7.0147812),
34 (46.0979767, 5.9697126),
35 (46.4142137, 6.5677645),
36 (45.8690191, 7.1026676),
37 (45.9015149, 7.8545345),
38 (46.4086133, 8.4121003),
39 (45.8274156, 9.0094792),
40 (46.4741242, 9.3507219),
41 (46.2297483, 10.157541),
42 (46.5731435, 10.068260),
43 (46.5810388, 10.496742),
44 (46.9718163, 10.414338),
45 (47.0381692, 9.6020123),
46 (47.5320018, 9.6006684),
47 (47.7892979, 8.5809824),
48 ];
49
50 let bern = [
51 (46.9666268, 7.1781895),
52 (47.1238637, 7.3361174),
53 (47.0593473, 7.6190164),
54 (46.8390079, 7.6863061),
55 (46.7638649, 7.3683927),
56 ];
57
58 let html = GoogleMap::new((49.7973, 5.4173), 6, None)
59 .draw(Marker::new((51.507, -0.127)).label("A").title("London"))
60 .draw(Marker::new((52.48, -1.902)).title("Birmingham"))
61 .draw(Polyline::new(netherlands).style(Color::Red))
62 .draw(Polygon::new(switzerland).path(bern).style(Color::Red))
63 .draw(
64 Rectangle::new((53.0833, 8.8), (51.3333, 12.3833))
65 .style(Color::Green)
66 .editable(true)
67 .draggable(true),
68 )
69 .draw(Circle::new((48.856, 2.352), 100_000.0).style(Color::HSL(200, 128, 100))) .draw_all(switzerland.iter().step_by(4).map(Marker::new))
71 .draw(
72 Polyline::new([(0.0, 0.0), (1.0, 1.0)])
73 .geodesic(true)
74 .editable(true),
75 )
76 .to_string();
77
78 println!("{}", html);
79 fs::write("map.html", html).unwrap();
80
81 }