Giter VIP home page Giter VIP logo

proj4j's Introduction

Proj4J GitHub Action Status Maven Central

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.

LocationTech

User Guide

Proj4J artifacts are available on maven central.

Using Proj4J with Maven

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.

Using Proj4J with Gradle

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.

Basic Usage

The following examples give a quick intro on how to use Proj4J in common use cases.

Transforming coordinates from WGS84 to UTM

Obtaining CRSs by name
CRSFactory crsFactory = new CRSFactory();
CoordinateReferenceSystem WGS84 = crsFactory.createFromName("epsg:4326");
CoordinateReferenceSystem UTM = crsFactory.createFromName("epsg:25833");
Obtaining CRSs using parameters
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");
Transforming coordinates
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);

Building, Testing and installing locally

mvn clean install

Publish to Maven Central

mvn -Dmaven.test.skip=true -Pcentral clean package deploy

Contributing

If you are interested in contributing to Proj4J please read the Contributing Guide.

proj4j's People

Contributors

bosborn avatar dependabot[bot] avatar dr-jts avatar echeipesh avatar halset avatar lossyrob avatar neutius avatar noberasco avatar pomadchin avatar rfecher avatar rhuitl avatar scaddenp avatar sebasbaumh avatar sebkur avatar skinkie avatar tuan-nng avatar yaqiang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.