FastGeoProjections.Ellipsoid
— TypeAn ellipsoidal representation of the Earth [modified from Geodesy.jl]
FastGeoProjections.Transformation
— TypeTransformation(source_epsg, target_epsg; threaded=true, always_xy=false, proj_only=false)
Create a Transformation that is a pipeline between two known coordinate reference systems. Transformation implements the CoordinateTransformations.jl API.
To do the transformation on coordinates, call an instance of this struct like a function. See below for an example. These functions accept either 2 numbers or two vectors of numbers.
source_crs
and target_crs
must be an EPSG authority code (see https://epsg.io/), like "EPSG:3413" or 3413::EPSG. The created pipeline will expect that the coordinates respect the axis order and axis unit of the official definition (so for example, for EPSG:4326, with latitude first and longitude next, in degrees). Similarly, when using that syntax for a target CRS, output values will be emitted according to the official definition of this CRS. This behavior can be overruled by passing always_xy=true
.
threaded
turns on an off multi-threading.
always_xy
can optionally fix the axis orderding to x,y or lon,lat order. By default it is false
, meaning the order is defined by the authority in charge of a given coordinate reference system, as explained in this PROJ FAQ entry.
proj_only
can optionally only use Proj.jl for Transformations even when a FastGeoProjection is available. By default Proj.jl is only used when a FastGeoProjection is not avaiable
Examples
julia> trans = Proj.Transformation("EPSG:4326", "EPSG:28992", always_xy=true)
Transformation
source: WGS 84 (with axis order normalized for visualization)
target: Amersfoort / RD New
julia> trans(5.39, 52.16) # this is in lon,lat order, since we set always_xy to true
(155191.3538124342, 463537.1362732911)
FastGeoProjections.ellipsoid
— Methodellipsoid(epsg::EPSG)
define an ellipsoid given an EPSG TODO: need to adapt this for new EPSG multiple value convention, likely second epsg not first
FastGeoProjections.epsg2epsg
— Methodepsg2epsg(source_epsg::EPSG, target_epsg::EPSG; threaded=true, proj_only=false)
Returns the Transform for points defined by x
and y
from one coordinate reference systems defined by source_epsg
to another define by target_epsg
. Coodinates x
and y
can be either a scalar or a vector. Multithreading can be turned on and off with threaded
. Optimized Julia native code used when available. To force use of Proj set proj_only = true
FastGeoProjections.polarstereo_fwd
— Methodpolarstereo_fwd(lon, lat; lon_0, lat_ts, ellips, threaded, always_xy)
Returns x and y coordinates [meteres] in Polar Stereographic (PS) coordinates given geodetic coordinates (EPSG:4326) of longitude and latitude [decimal degrees]. The PS projection is defined kwargs of: lon0: the meridian along positive Y axis, latts: standard parallel, which is the latitude of true scale and an ellipsoid that is define by an equatorial radius in meters (a) and its eccentricity (e). Also returnes scale factor (k).
FastGeoProjections.polarstereo_inv
— Methodpolarstereo_inv(x, y; lon_0, lat_ts, ellips, threaded, always_xy)
Returns geodetic coordinates (EPSG:4326) of longitude and latitude [decimal degrees] given x and y coordinates [meteres] in Polar Stereographic (PS) coordinates. The PS projection is defined kwargs of: lon0: the meridian along positive Y axis, latts: standard parallel, which is the latitude of true scale and an ellipsoid that is define by an equatorial radius in meters (a) and its eccentricity (e).
FastGeoProjections.utm_epsg
— Functionutm_epsg(lon::Real, lat::Real, always_xy=true)
returns the EPSG code for the intersecting universal transverse Mercator (UTM) zone -OR- the relevant polar stereographic projection if outside of UTM limits.
modified from: https://github.com/JuliaGeo/Geodesy.jl/blob/master/src/utm.jl
FastGeoProjections.utm_inv
— Methodutm_inv(lon, lat; epsg::EPSG=EPSG(0), zone, isnorth, threaded, always_xy)
Returns geodetic coordinates (EPSG:4326) of longitude and latitude [decimal degrees] given x and y coordinates [meteres] in UTM projection. The UTM projection is defined by kwargs of EPSG or zone and isnorth. Also returnes meridian convergence (gam) and scale factor (k).