Proj4J is a Java library for converting coordinates between different geospatial coordinate reference systems.
It is designed to be compatible with proj.4
parameters and derives some of its implementation from the proj.4
sources.
Proj4J is a project in the LocationTech working group of the Eclipse Foundation.
Proj4J artifacts are available on maven central.
!Important! As of 1.2.2
version, proj4-core
contains no EPSG Licensed files.
In order to make proj4j properly operate, it makes sense to consider proj4-epsg
dependency usage.
To include Proj4J in a Maven project, add a dependency block like the following:
<properties>
<proj4j.version>{latest version}</proj4j.version>
</properties>
<dependency>
<groupId>org.locationtech.proj4j</groupId>
<artifactId>proj4j</artifactId>
<version>${proj4j.version}</version>
</dependency>
where {latest version}
refers to the version indicated by the badge above.
Proj4J-EPSG
module distributes a portion of the EPSG dataset. This artifact is released the EPSG database distribution license.
To include Proj4J-EPSG
in a Maven project, add a dependency block like the following:
<properties>
<proj4j.version>{latest version}</proj4j.version>
</properties>
<dependency>
<groupId>org.locationtech.proj4j</groupId>
<artifactId>proj4j-epsg</artifactId>
<version>${proj4j.version}</version>
</dependency>
where {latest version}
refers to the version indicated by the badge above.
To include Proj4J in a Gradle project, add a dependency block like the following:
dependencies {
implementation 'org.locationtech.proj4j:proj4j:{latest version}'
}
where {latest version}
refers to the version indicated by the badge above.
Proj4J-EPSG
module distributes a portion of the EPSG dataset. This artifact is released the EPSG database distribution license.
To include Proj4J-EPSG
in a Gradle project, add the following line to the dependency block:
implementation 'org.locationtech.proj4j:proj4j-epsg:{latest version}'
where {latest version}
refers to the version indicated by the badge above.
The following examples give a quick intro on how to use Proj4J in common use cases.
CRSFactory crsFactory = new CRSFactory();
CoordinateReferenceSystem WGS84 = crsFactory.createFromName("epsg:4326");
CoordinateReferenceSystem UTM = crsFactory.createFromName("epsg:25833");
CRSFactory crsFactory = new CRSFactory();
CoordinateReferenceSystem WGS84 = crsFactory.createFromParameters("WGS84",
"+proj=longlat +datum=WGS84 +no_defs");
CoordinateReferenceSystem UTM = crsFactory.createFromParameters("UTM",
"+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
CoordinateTransformFactory ctFactory = new CoordinateTransformFactory();
CoordinateTransform wgsToUtm = ctFactory.createTransform(WGS84, UTM);
// `result` is an output parameter to `transform()`
ProjCoordinate result = new ProjCoordinate();
wgsToUtm.transform(new ProjCoordinate(lon, lat), result);
mvn clean install
mvn -Dmaven.test.skip=true -Pcentral clean package deploy
For more details see HOWTORELEASE.txt.
If you are interested in contributing to Proj4J please read the Contributing Guide.