forked from danielalvsaaker/staticmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrect.rs
31 lines (25 loc) · 887 Bytes
/
rect.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use staticmap::{
tools::{Color, RectBuilder},
Error, StaticMapBuilder,
};
fn main() -> Result<(), Error> {
let mut map = StaticMapBuilder::new().width(200).height(200).build()?;
let rect1 = RectBuilder::new()
.north_lat_coordinate(43.12398687511079)
.south_lat_coordinate(43.107942538441854)
.east_lon_coordinate(141.39078581150866)
.west_lon_coordinate(141.37070467336105)
.color(Color::new(true, 255, 0, 0, 255))
.build()?;
let rect2 = RectBuilder::new()
.north_lat_coordinate(42.81587629948163)
.south_lat_coordinate(42.76094473505349)
.east_lon_coordinate(141.698469171195)
.west_lon_coordinate(141.65625418708007)
.color(Color::new(true, 0, 0, 255, 255))
.build()?;
map.add_tool(rect1);
map.add_tool(rect2);
map.save_png("rect.png")?;
Ok(())
}