https://github.com/juliageo/proj.jl
Julia wrapper for the PROJ cartographic projections library
https://github.com/juliageo/proj.jl
geo geospatial gis julia proj
Last synced: about 2 months ago
JSON representation
Julia wrapper for the PROJ cartographic projections library
- Host: GitHub
- URL: https://github.com/juliageo/proj.jl
- Owner: JuliaGeo
- License: mit
- Created: 2015-08-25T14:38:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-02-17T08:59:04.000Z (3 months ago)
- Last Synced: 2025-03-29T17:08:25.891Z (about 2 months ago)
- Topics: geo, geospatial, gis, julia, proj
- Language: Julia
- Homepage:
- Size: 661 KB
- Stars: 47
- Watchers: 12
- Forks: 10
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Proj.jl
[](https://github.com/JuliaGeo/Proj.jl/actions?query=workflow%3ACI)
A simple [Julia](https://julialang.org/) wrapper around the [PROJ](https://proj.org/)
cartographic projections library. This package has been renamed from [Proj4.jl](https://github.com/JuliaGeo/Proj.jl/tree/v0.7.6) to Proj.jl.Quickstart, based on the [PROJ docs](https://proj.org/development/quickstart.html):
```julia
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 https://proj.org/faq.html#why-is-the-axis-ordering-in-proj-not-consistent
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 https://proj.org/resource_files.html, 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, and `Proj.with_network` provides
a way to temporarily enable or disable it in a do-block. 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:
https://proj.org/development/reference/index.html