georust / proj

Rust bindings for the latest stable release of PROJ
https://docs.rs/proj
Apache License 2.0
137 stars 45 forks source link

Add debug representation for proj::Proj #64

Closed frewsxcv closed 3 years ago

frewsxcv commented 3 years ago

Using the proj_pj_info function, we can retrieve info about the underlying PJ structure created from proj_create. I used this code to debug https://github.com/georust/proj/pull/63.

https://proj.org/development/reference/functions.html#c.proj_pj_info

let pj = unsafe { proj_create(ctx, c_definition.as_ptr()) };

unsafe {
    let pj_proj_info = proj_sys::proj_pj_info(pj);
    println!("id: {}", _string(pj_proj_info.id));
    println!("description: {}", _string(pj_proj_info.description));
    println!("definition: {}", _string(pj_proj_info.definition));
    println!("has_inverse: {}", pj_proj_info.has_inverse == 1);
    println!("accuracy: {}", pj_proj_info.accuracy);
}