Remove bound extending
This commit is contained in:
parent
1dc12f813d
commit
5198f32f2e
2 changed files with 2 additions and 18 deletions
|
|
@ -6,8 +6,6 @@ pub const H3_REQUEST_MAX: u8 = 12;
|
||||||
|
|
||||||
pub const SERVER_ADDRESS: &str = "0.0.0.0:8001";
|
pub const SERVER_ADDRESS: &str = "0.0.0.0:8001";
|
||||||
|
|
||||||
pub const BOUNDS_QUANTIZATION: f64 = 0.01;
|
|
||||||
pub const BOUNDS_BUFFER_PERCENT: f64 = 0.1;
|
|
||||||
pub const GRID_CELL_SIZE: f32 = 0.01;
|
pub const GRID_CELL_SIZE: f32 = 0.01;
|
||||||
pub const MAX_POIS_PER_REQUEST: usize = 2500;
|
pub const MAX_POIS_PER_REQUEST: usize = 2500;
|
||||||
pub const DEFAULT_PROPERTIES_LIMIT: usize = 100;
|
pub const DEFAULT_PROPERTIES_LIMIT: usize = 100;
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,7 @@ use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Map, Value};
|
use serde_json::{Map, Value};
|
||||||
use tracing::{info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
use crate::consts::{
|
use crate::consts::{H3_PRECOMPUTE_MAX, H3_REQUEST_MAX, H3_REQUEST_MIN};
|
||||||
BOUNDS_BUFFER_PERCENT, BOUNDS_QUANTIZATION, H3_PRECOMPUTE_MAX, H3_REQUEST_MAX, H3_REQUEST_MIN,
|
|
||||||
};
|
|
||||||
use crate::parsing::{parse_bounds, parse_filters, row_passes_filters};
|
use crate::parsing::{parse_bounds, parse_filters, row_passes_filters};
|
||||||
use crate::state::AppState;
|
use crate::state::AppState;
|
||||||
|
|
||||||
|
|
@ -163,19 +161,7 @@ pub async fn get_hexagons(
|
||||||
"bounds parameter is required".into(),
|
"bounds parameter is required".into(),
|
||||||
))?;
|
))?;
|
||||||
|
|
||||||
let (mut south, mut west, mut north, mut east) = parse_bounds(&bounds_str)?;
|
let (south, west, north, east) = parse_bounds(&bounds_str)?;
|
||||||
|
|
||||||
let lat_range = north - south;
|
|
||||||
let lng_range = east - west;
|
|
||||||
south -= lat_range * BOUNDS_BUFFER_PERCENT;
|
|
||||||
north += lat_range * BOUNDS_BUFFER_PERCENT;
|
|
||||||
west -= lng_range * BOUNDS_BUFFER_PERCENT;
|
|
||||||
east += lng_range * BOUNDS_BUFFER_PERCENT;
|
|
||||||
|
|
||||||
south = (south / BOUNDS_QUANTIZATION).floor() * BOUNDS_QUANTIZATION;
|
|
||||||
west = (west / BOUNDS_QUANTIZATION).floor() * BOUNDS_QUANTIZATION;
|
|
||||||
north = (north / BOUNDS_QUANTIZATION).ceil() * BOUNDS_QUANTIZATION;
|
|
||||||
east = (east / BOUNDS_QUANTIZATION).ceil() * BOUNDS_QUANTIZATION;
|
|
||||||
|
|
||||||
let filters_str = params.filters.clone();
|
let filters_str = params.filters.clone();
|
||||||
let (parsed_filters, parsed_enum_filters) = parse_filters(
|
let (parsed_filters, parsed_enum_filters) = parse_filters(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue