Skip to content

Commit a7cffa8

Browse files
feat: change type of bounds to f32 instead of i32 (#1) (h/t @jaspervercnocke)
* Change type of bounds to f32 instead of i32
1 parent 09f051a commit a7cffa8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/tilejson.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub struct TileJSON {
9090
/// covered by all zoom levels. The bounds are represented in WGS:84
9191
/// latitude and longitude values, in the order left, bottom, right, top.
9292
/// Values may be integers or floating point numbers.
93-
pub bounds: Option<Vec<i32>>,
93+
pub bounds: Option<Vec<f32>>,
9494

9595
/// The first value is the longitude, the second is latitude (both in
9696
/// WGS:84 values), the third value is the zoom level as an integer.
@@ -118,7 +118,7 @@ pub struct TileJSONBuilder {
118118
data: Option<Vec<String>>,
119119
minzoom: Option<u8>,
120120
maxzoom: Option<u8>,
121-
bounds: Option<Vec<i32>>,
121+
bounds: Option<Vec<f32>>,
122122
center: Option<Vec<i32>>,
123123
}
124124

@@ -139,7 +139,7 @@ impl TileJSONBuilder {
139139
data: None,
140140
minzoom: Some(0),
141141
maxzoom: Some(30),
142-
bounds: Some(vec![-180, -90, 180, 90]),
142+
bounds: Some(vec![-180.0, -90.0, 180.0, 90.0]),
143143
center: None,
144144
}
145145
}
@@ -209,7 +209,7 @@ impl TileJSONBuilder {
209209
self
210210
}
211211

212-
pub fn bounds(&mut self, bounds: Vec<i32>) -> &mut TileJSONBuilder {
212+
pub fn bounds(&mut self, bounds: Vec<f32>) -> &mut TileJSONBuilder {
213213
self.bounds = Some(bounds);
214214
self
215215
}
@@ -298,7 +298,7 @@ mod tests {
298298

299299
assert_eq!(
300300
serialized_tilejson,
301-
r#"{"tilejson":"2.2.0","id":null,"name":"compositing","description":null,"version":"1.0.0","attribution":null,"template":null,"legend":null,"scheme":"tms","tiles":["http://localhost:8888/admin/1.0.0/world-light,broadband/{z}/{x}/{y}.png"],"grids":null,"data":null,"minzoom":0,"maxzoom":30,"bounds":[-180,-90,180,90],"center":null}"#
301+
r#"{"tilejson":"2.2.0","id":null,"name":"compositing","description":null,"version":"1.0.0","attribution":null,"template":null,"legend":null,"scheme":"tms","tiles":["http://localhost:8888/admin/1.0.0/world-light,broadband/{z}/{x}/{y}.png"],"grids":null,"data":null,"minzoom":0,"maxzoom":30,"bounds":[-180.0,-90.0,180.0,90.0],"center":null}"#
302302
)
303303
}
304304
}

0 commit comments

Comments
 (0)