JuliaGeo / GeometryOps.jl

GeoInterface-based geometry operations
https://juliageo.org/GeometryOps.jl/
MIT License
30 stars 4 forks source link

Which earth radius to use #221

Open tiemvanderdeure opened 1 month ago

tiemvanderdeure commented 1 month ago

In the new GeometryOpsCore, the radius defaults to the earth's radius at the equator:

https://github.com/JuliaGeo/GeometryOps.jl/blob/9c6db7d7ea6480ef03cdc686b456aaae6ad141b7/GeometryOpsCore/src/types.jl#L62-L64

I'm no expert and basically going off wikipedia here, but wouldn't it be more intuitive to use the mean radius instead? The arithmetic mean, equal area, and equal volume radius are all 6371 km.

https://en.wikipedia.org/wiki/Earth_radius#Global_radii

asinghvi17 commented 1 month ago

Thanks, just made the change.

BTW, piggybacking on this issue, we should be able to convert a Geodesic() (maybe Ellipsoidal()?) to Spherical() using the same sphericalization parameters as PROJ does for ellipsoids. Here's a link:

        The ellipsoid definition may be augmented with a spherification flag,
    turning the ellipsoid into a sphere with features defined by the ellipsoid.

        Spherification parameters supported are:
            R_A, which gives a sphere with the same surface area as the
            ellipsoid R_V, which gives a sphere with the same volume as the
    ellipsoid

            R_a, which gives a sphere with R = (a + b)/2   (arithmetic mean)
            R_g, which gives a sphere with R = sqrt(a*b)   (geometric mean)
            R_h, which gives a sphere with R = 2*a*b/(a+b) (harmonic mean)

            R_lat_a=phi, which gives a sphere with R being the arithmetic mean
            of of the corresponding ellipsoid at latitude phi.
            R_lat_g=phi, which gives
            a sphere with R being the geometric mean of of the corresponding
    ellipsoid at latitude phi.

            R_C, which gives a sphere with the radius of the conformal sphere
            at phi0.

https://github.com/OSGeo/PROJ/blob/0134c145053ffac92c42b5ab0109b41c8be417e7/src/ell_set.cpp#L51C13-L66C21

asinghvi17 commented 1 month ago

https://github.com/OSGeo/PROJ/blob/0134c145053ffac92c42b5ab0109b41c8be417e7/src/ell_set.cpp#L355-L466 is the definition of the spherification function, it doesn't seem too hard.