Skip to content

Commit

Permalink
update flatgeobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkirk authored and pka committed Jun 28, 2022
1 parent ce4cfb4 commit 678bc9d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion geozero-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ geojson = "0.23.0"
criterion = "0.3.3"
geo-types = { version = "0.7", default-features = false }
geo = "0.17" # { version = "0.17", features = ["postgis-integration"] }
flatgeobuf = "0.5.0"
flatgeobuf = "0.8.0"
seek_bufread = "1.2"
postgres = "0.19"
postgis = "0.8.0"
Expand Down
27 changes: 14 additions & 13 deletions geozero-bench/benches/geobench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ mod fgb {

pub(super) fn fgb_to_geo(fpath: &str, bbox: &Option<Extent>, count: usize) -> Result<()> {
let mut filein = BufReader::new(File::open(fpath)?);
let mut fgb = FgbReader::open(&mut filein)?;
if let Some(bbox) = bbox {
fgb.select_bbox(bbox.minx, bbox.miny, bbox.maxx, bbox.maxy)?;
let opened_fgb = FgbReader::open(&mut filein)?;
let mut selected_fgb = if let Some(bbox) = bbox {
opened_fgb.select_bbox(bbox.minx, bbox.miny, bbox.maxx, bbox.maxy)?
} else {
fgb.select_all()?;
}
opened_fgb.select_all()?
};
let mut cnt = 0;
while let Some(feature) = fgb.next()? {
while let Some(feature) = selected_fgb.next()? {
let _geom = feature.to_geo()?;
cnt += 1;
}
Expand All @@ -41,15 +41,16 @@ mod fgb {
count: usize,
) -> Result<()> {
let url = format!("http://127.0.0.1:3333/{}", fname);
let mut fgb = HttpFgbReader::open(&url).await?;
if let Some(bbox) = bbox {
fgb.select_bbox(bbox.minx, bbox.miny, bbox.maxx, bbox.maxy)
.await?;
let opened_fgb = HttpFgbReader::open(&url).await?;
let mut selected_fgb = if let Some(bbox) = bbox {
opened_fgb
.select_bbox(bbox.minx, bbox.miny, bbox.maxx, bbox.maxy)
.await?
} else {
fgb.select_all().await?;
}
opened_fgb.select_all().await?
};
let mut cnt = 0;
while let Some(feature) = fgb.next().await? {
while let Some(feature) = selected_fgb.next().await? {
let _geom = feature.to_geo()?;
cnt += 1;
}
Expand Down

0 comments on commit 678bc9d

Please sign in to comment.