Julia wrapper for the PROJ cartographic projections library
44 Stars
Updated Last
11 Months Ago
Started In
August 2015



A simple Julia wrapper around the PROJ cartographic projections library. This package has been renamed from Proj4.jl to Proj.jl.

Quickstart, based on the PROJ docs:

using Proj

# Proj.jl implements the CoordinateTransformations.jl API.
# A Proj.Transformation needs the source and target coordinate reference systems (CRS),
# or a single pipeline.
trans = Proj.Transformation("EPSG:4326", "+proj=utm +zone=32 +datum=WGS84")
# The CRS can be a string or the CRS type, which also interfaces with GeoFormatTypes.jl.

# Once created, you can call this object to transform points.
# The result will be a tuple of Float64s, of length 2, 3 or 4 depending on the input length.
# The 3rd coordinate is elevation (default 0), and the 4th is time (default Inf).
# Here the (latitude, longitude) of Copenhagen is entered
trans(55, 12)
# -> (691875.632137542, 6.098907825129169e6)
# Passing coordinates as a single tuple or vector also works.

# Note that above the latitude is passed first, because that is the axis order that the
# EPSG mandates. If you want to pass in (longitude, latitude) / (x, y), you can set the
# `always_xy` keyword to true. For more info see
trans = Proj.Transformation("EPSG:4326", "+proj=utm +zone=32 +datum=WGS84", always_xy=true)

# now we input (longitude, latitude), and get the same result as above
trans(12, 55)
# -> (691875.632137542, 6.098907825129169e6)

# using `inv` we can reverse the direction, `compose` can combine two transformations in one
inv(trans)(691875.632137542, 6.098907825129169e6) == (12, 55)

Note that, as described in, PROJ has the capability to use remote grids for transformations that need them. Unless you have manually set the environment variable PROJNETWORK=ON or changed proj.ini, networking is disabled by default. To enable from Julia, run Proj.enable_network!(). Proj.network_enabled() can be used to check the setting. Note that it needs to be set before creating a transformation, otherwise it will have no effect.

API documentation for the underlying C API may be found here: