Git Product home page Git Product logo

coordinate-reference-systems-java's Introduction

Coordinate Reference Systems Java

Coordinate Reference Systems Lib

The Coordinate Reference Systems Library was developed at the National Geospatial-Intelligence Agency (NGA) in collaboration with BIT Systems. The government has "unlimited rights" and is releasing this software to increase the impact of government investments by providing developers with the opportunity to take things in new directions. The software use, modification, and distribution rights are stipulated within the MIT license.

Pull Requests

If you'd like to contribute to this project, please make a pull request. We'll review the pull request and discuss the changes. All pull request contributions to this project will be released under the MIT license.

Software source code previously released under an open source license and then modified by NGA staff is considered a "joint work" (see 17 USC ยง 101); it is partially copyrighted, partially public domain, and as a whole is protected by the copyrights of the non-government authors and must be released according to the terms of the original open source license.

About

Coordinate Reference Systems is a Java library implementation of OGC's 'Geographic information โ€” Well-known text representation of coordinate reference systems' (18-010r7) specification.

For projection conversions between coordinates, see Projections (backed by proj4j).

Usage

View the latest Javadoc

// String wkt = ...

CRS crs = CRSReader.read(wkt);

CRSType type = crs.getType();
CategoryType category = crs.getCategoryType();

String text = CRSWriter.write(crs);
String prettyText = CRSWriter.writePretty(crs);

switch (category) {

case CRS:

  CoordinateReferenceSystem coordRefSys = (CoordinateReferenceSystem) crs;

  switch (type) {
  case BOUND:
    BoundCoordinateReferenceSystem bound = (BoundCoordinateReferenceSystem) coordRefSys;
    // ...
    break;
  case COMPOUND:
    CompoundCoordinateReferenceSystem compound = (CompoundCoordinateReferenceSystem) coordRefSys;
    // ...
    break;
  case DERIVED:
    DerivedCoordinateReferenceSystem derived = (DerivedCoordinateReferenceSystem) coordRefSys;
    // ...
    break;
  case ENGINEERING:
    EngineeringCoordinateReferenceSystem engineering = (EngineeringCoordinateReferenceSystem) coordRefSys;
    // ...
    break;
  case GEODETIC:
  case GEOGRAPHIC:
    GeoCoordinateReferenceSystem geo = (GeoCoordinateReferenceSystem) coordRefSys;
    // ...
    break;
  case PARAMETRIC:
    ParametricCoordinateReferenceSystem parametric = (ParametricCoordinateReferenceSystem) coordRefSys;
    // ...
    break;
  case PROJECTED:
    ProjectedCoordinateReferenceSystem projected = (ProjectedCoordinateReferenceSystem) coordRefSys;
    // ...
    break;
  case TEMPORAL:
    TemporalCoordinateReferenceSystem temporal = (TemporalCoordinateReferenceSystem) coordRefSys;
    // ...
    break;
  case VERTICAL:
    VerticalCoordinateReferenceSystem vertical = (VerticalCoordinateReferenceSystem) coordRefSys;
    // ...
    break;
  default:
  }

  // ...
  break;

case METADATA:

  CoordinateMetadata metadata = (CoordinateMetadata) crs;

  // ...
  break;

case OPERATION:

  Operation operation = (Operation) crs;

  switch (type) {
  case CONCATENATED_OPERATION:
    ConcatenatedOperation concatenatedOperation = (ConcatenatedOperation) operation;
    // ...
    break;
  case COORDINATE_OPERATION:
    CoordinateOperation coordinateOperation = (CoordinateOperation) operation;
    // ...
    break;
  case POINT_MOTION_OPERATION:
    PointMotionOperation pointMotionOperation = (PointMotionOperation) operation;
    // ...
    break;
  default:
  }

  // ...
  break;

}

PROJ

// String wkt = ...

CRS crs = CRSReader.read(wkt);

ProjParams projParamsFromCRS = ProjParser.params(crs);
String projTextFromCRS = ProjParser.paramsText(crs);
ProjParams projParamsFromWKT = ProjParser.params(wkt);
String projTextFromWKT = ProjParser.paramsText(wkt);

Installation

Pull from the Maven Central Repository (JAR, POM, Source, Javadoc)

<dependency>
    <groupId>mil.nga</groupId>
    <artifactId>crs</artifactId>
    <version>1.1.5</version>
</dependency>

Build

Build & Test

Build this repository using Eclipse and/or Maven:

mvn clean install

Pretty

The jar includes a pretty Well-Known Text main class utility that can be run from command line.

Parse OGC Coordinate Reference System Well-Known Text (1|2) and pretty print Coordinate Reference System Well-Known Text 2 and PROJ params. Download pretty.zip and follow the instructions.

Or run against the jar:

java -jar crs-*.jar [well-known_text]

coordinate-reference-systems-java's People

Contributors

bosborn avatar danielbarela avatar willcohen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  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.