Compare commits
No commits in common. "4372d0c2140d5ccc62925bf5e4e86f04006cbd32" and "8ef0c4ce59209956c55c6a789416691eacdc3e55" have entirely different histories.
4372d0c214
...
8ef0c4ce59
|
|
@ -1,4 +1,3 @@
|
||||||
/target
|
/target
|
||||||
*~
|
*~
|
||||||
\#*#
|
\#*#
|
||||||
.#*
|
|
||||||
File diff suppressed because it is too large
Load Diff
23
Cargo.toml
23
Cargo.toml
|
|
@ -6,14 +6,15 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde_json = "1.0"
|
serde_json = "~1.0"
|
||||||
tokio = {version="1.35", features=["rt-multi-thread", "macros"]}
|
tokio = {version="~1.17", features=["rt-multi-thread", "macros"]}
|
||||||
tokio-util = {version="0.7", features=["io"]}
|
tokio-util = {version="~0.7", features=["io"]}
|
||||||
reqwest = {version="0.11", features=["json", "stream"]}
|
reqwest = {version="~0.11", features=["json", "stream"]}
|
||||||
proj = "0.27"
|
proj = "~0.25"
|
||||||
geo-types = "0.7"
|
geo-types = "~0.7"
|
||||||
clap = {version="3.1", features=["derive"]}
|
clap = {version="~3.1", features=["derive"]}
|
||||||
anyhow = "1.0"
|
anyhow = "~1.0"
|
||||||
futures = "0.3"
|
futures = "~0.3"
|
||||||
bytes = "1.5"
|
bytes = "~1.1"
|
||||||
las = {version="0.8", features=["laz"]}
|
las = {version="~0.7", features=["laz"]}
|
||||||
|
ash = {version="~0.36", features=["linked"]}
|
||||||
25
src/geonb.rs
25
src/geonb.rs
|
|
@ -19,7 +19,7 @@ impl std::fmt::Display for Error {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::error::Error for Error {}
|
impl std::error::Error for Error {}
|
||||||
fn convert_err(_err: reqwest::Error) -> std::io::Error {
|
fn convert_err(err: reqwest::Error) -> std::io::Error {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
pub async fn get_lidar_tile_around_point(
|
pub async fn get_lidar_tile_around_point(
|
||||||
|
|
@ -86,3 +86,26 @@ pub async fn get_lidar_tile_around_point(
|
||||||
.map_err(convert_err),
|
.map_err(convert_err),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn test() -> Result<(), reqwest::Error> {
|
||||||
|
let client = reqwest::Client::new();
|
||||||
|
print!(
|
||||||
|
"{}",
|
||||||
|
serde_json::to_string_pretty(&client
|
||||||
|
.get("https://geonb.snb.ca/arcgis/rest/services/GeoNB_SNB_LidarIndex/MapServer/1/query")
|
||||||
|
.query(&[("f", "json"),("geometryType","esriGeometryPoint"),("geometry","2470000,7443000"),("returnIdsOnly","true")])
|
||||||
|
.send()
|
||||||
|
.await?
|
||||||
|
.json::<serde_json::Value>().await?).expect("JSON")
|
||||||
|
);
|
||||||
|
print!(
|
||||||
|
"{}",
|
||||||
|
serde_json::to_string_pretty(&client
|
||||||
|
.get("https://geonb.snb.ca/arcgis/rest/services/GeoNB_SNB_LidarIndex/MapServer/1/14601")
|
||||||
|
.query(&[("f", "json")])
|
||||||
|
.send()
|
||||||
|
.await?
|
||||||
|
.json::<serde_json::Value>().await?).expect("JSON")
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
|
||||||
91
src/main.rs
91
src/main.rs
|
|
@ -1,4 +1,11 @@
|
||||||
use {clap::Parser, geo_types::Point, las::Read as LasRead, proj::Proj, tokio::io::AsyncReadExt};
|
use {
|
||||||
|
ash::{vk, Entry},
|
||||||
|
clap::Parser,
|
||||||
|
geo_types::Point,
|
||||||
|
las::Read as LasRead,
|
||||||
|
proj::Proj,
|
||||||
|
tokio::io::AsyncReadExt,
|
||||||
|
};
|
||||||
|
|
||||||
mod geonb;
|
mod geonb;
|
||||||
|
|
||||||
|
|
@ -12,16 +19,92 @@ struct Args {
|
||||||
// Longitude to fetch LIDAR tile at
|
// Longitude to fetch LIDAR tile at
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
longitude: Option<f64>,
|
longitude: Option<f64>,
|
||||||
|
}
|
||||||
|
|
||||||
// Print extra debug info when initializing Vulkan
|
fn pretty_print_memory_size(x: u64) -> String {
|
||||||
#[clap(long)]
|
if x > 1_000_000_000 {
|
||||||
debug_init: bool,
|
format!("{:.1}G", x / 1_000_000_000)
|
||||||
|
} else if x > 1_000_000 {
|
||||||
|
format!("{:.0}M", x / 1_000_000)
|
||||||
|
} else if x > 1000 {
|
||||||
|
format!("{:.0}K", x / 1000)
|
||||||
|
} else {
|
||||||
|
format!("{}", x)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn init_vulkan() {
|
||||||
|
let instance = {
|
||||||
|
let entry = Entry::linked();
|
||||||
|
let app_info = vk::ApplicationInfo {
|
||||||
|
api_version: vk::make_api_version(0, 1, 0, 0),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let create_info = vk::InstanceCreateInfo {
|
||||||
|
p_application_info: &app_info,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
unsafe {
|
||||||
|
entry
|
||||||
|
.create_instance(&create_info, None)
|
||||||
|
.expect("vulkan instance")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
instance
|
||||||
|
.enumerate_physical_devices()
|
||||||
|
.expect("vulkan physical devices")
|
||||||
|
.iter()
|
||||||
|
.for_each(|&device| {
|
||||||
|
let device_properties = instance.get_physical_device_properties(device);
|
||||||
|
let api_version = device_properties.api_version;
|
||||||
|
let api_major_version = (api_version >> 22) & 0x7f;
|
||||||
|
let api_minor_version = (api_version >> 12) & 0x3ff;
|
||||||
|
println!(
|
||||||
|
"{}:\n\tAPI Version{}.{}\n\t{:?}",
|
||||||
|
std::ffi::CStr::from_ptr(&device_properties.device_name[0])
|
||||||
|
.to_str()
|
||||||
|
.expect("device name string"),
|
||||||
|
api_major_version,
|
||||||
|
api_minor_version,
|
||||||
|
device_properties.device_type
|
||||||
|
);
|
||||||
|
println!("\tMemory:");
|
||||||
|
let memory_properties = instance.get_physical_device_memory_properties(device);
|
||||||
|
for i in 0..memory_properties.memory_type_count as usize {
|
||||||
|
let memory_type = memory_properties.memory_types[i];
|
||||||
|
println!("\t\t{:?}", memory_type.property_flags);
|
||||||
|
let heap_index = memory_type.heap_index as usize;
|
||||||
|
let heap = memory_properties.memory_heaps[heap_index];
|
||||||
|
println!(
|
||||||
|
"\t\t\t{}: {}\t{:?}",
|
||||||
|
heap_index,
|
||||||
|
pretty_print_memory_size(heap.size),
|
||||||
|
heap.flags
|
||||||
|
);
|
||||||
|
}
|
||||||
|
println!("\tQueues:");
|
||||||
|
instance
|
||||||
|
.get_physical_device_queue_family_properties(device)
|
||||||
|
.iter()
|
||||||
|
.enumerate()
|
||||||
|
.for_each(|(i, queue_info)| {
|
||||||
|
println!(
|
||||||
|
"\t\t{}: {:?} ({})",
|
||||||
|
i, queue_info.queue_flags, queue_info.queue_count
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), anyhow::Error> {
|
async fn main() -> Result<(), anyhow::Error> {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
|
init_vulkan();
|
||||||
|
|
||||||
if let (Some(latitude), Some(longitude)) = (args.latitude, args.longitude) {
|
if let (Some(latitude), Some(longitude)) = (args.latitude, args.longitude) {
|
||||||
let location = Proj::new_known_crs("+proj=longlat +datum=WGS84", "EPSG:2953", None)
|
let location = Proj::new_known_crs("+proj=longlat +datum=WGS84", "EPSG:2953", None)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue