diff --git a/ext/RastersProjExt/cellarea.jl b/ext/RastersProjExt/cellarea.jl index 9d9d506d..7b2cda59 100644 --- a/ext/RastersProjExt/cellarea.jl +++ b/ext/RastersProjExt/cellarea.jl @@ -38,9 +38,11 @@ end _lonlat_to_sphericalpoint(args) = _lonlat_to_sphericalpoint(args...) function _lonlat_to_sphericalpoint(lon, lat) - x = cosd(lat) * cosd(lon) - y = cosd(lat) * sind(lon) - z = sind(lat) + lonsin, loncos = sincosd(lon) + latsin, latcos = sincosd(lat) + x = latcos * loncos + y = latcos * lonsin + z = latsin return SphericalPoint(x,y,z) end @@ -182,4 +184,4 @@ function axis_is_degrees(crs::Proj.CRS, axis_index::Int; context::Ptr{Proj.PJ_CO # in which case we should technically return true. # We'd also have to return the conversion factor in this case, and maybe the category (radians or degrees)... return isequal(unit_str, "degree") -end \ No newline at end of file +end