diff --git a/src/utils.jl b/src/utils.jl index 48e1cd7d..c3134568 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -385,6 +385,25 @@ function remove_overlapping_ticks!(scene, xpositions, xlabels, xvisible, ypositi return end +################################################################################ +# Proj boundingbox utils # +################################################################################ + +function get_area_of_use(pj) + out_west_lon_degree = Ref{Cdouble}(NaN) + out_south_lat_degree = Ref{Cdouble}(NaN) + out_east_lon_degree = Ref{Cdouble}(NaN) + out_north_lat_degree = Ref{Cdouble}(NaN) + out_area_name = Ref{Cstring}(C_NULL) + + res = Proj.proj_get_area_of_use(pj, out_west_lon_degree, out_south_lat_degree, out_east_lon_degree, out_north_lat_degree, out_area_name) + + res == 0 && @warn "There was no area of use assigned to the input PJ pointer!" + out_area_name[] == C_NULL || println(unsafe_string(out_area_name[])) + + return res == 0 ? nothing : Makie.BBox(out_west_lon_degree[], out_east_lon_degree[], out_south_lat_degree[], out_north_lat_degree[]) +end + ############################################################ # # # Useful macros #