Git Product home page Git Product logo

gars-java's Introduction

GARS Java

Global Area Reference System Lib

The GARS 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

GARS is a Java library providing Global Area Reference System functionality, a standardized geospatial reference system for areas.

Usage

View the latest Javadoc

Coordinates

GARS gars = GARS.parse("006AG39");
Point point = gars.toPoint();
Point pointMeters = point.toMeters();

double latitude = 63.98862388;
double longitude = 29.06755082;
Point point2 = Point.point(longitude, latitude);
GARS gars2 = GARS.from(point2);
String garsCoordinate = gars2.toString();
String gars30m = gars2.coordinate(GridType.THIRTY_MINUTE);
String gars15m = gars2.coordinate(GridType.FIFTEEN_MINUTE);
String gars5m = gars2.coordinate(GridType.FIVE_MINUTE);

Draw Tile Template

See gars-android for a concrete example

// GridTile tile = ...;

Grids grids = Grids.create();

ZoomGrids zoomGrids = grids.getGrids(tile.getZoom());
if (zoomGrids.hasGrids()) {

  for (Grid grid : zoomGrids) {

    List<GridLine> lines = grid.getLines(tile);
    if (lines != null) {
      for (GridLine line : lines) {
        Pixel pixel1 = line.getPoint1().getPixel(tile);
        Pixel pixel2 = line.getPoint2().getPixel(tile);
        // Draw line
      }
    }

    List<GridLabel> labels = grid.getLabels(tile);
    if (labels != null) {
      for (GridLabel label : labels) {
        PixelRange pixelRange = label.getBounds()
            .getPixelRange(tile);
        Pixel centerPixel = label.getCenter().getPixel(tile);
        // Draw label
      }
    }

  }
}

Properties

Default grid properties including zoom ranges, styles, and labelers are defined in gars.properties. The defaults can be changed in code by modifying the Grids.

Installation

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

<dependency>
    <groupId>mil.nga</groupId>
    <artifactId>gars</artifactId>
    <version>1.1.3</version>
</dependency>

Build

Build & Test

Build this repository using Eclipse and/or Maven:

mvn clean install

Remote Dependencies

  • Grid Java (The MIT License (MIT)) - Grid Library

gars-java's People

Contributors

bosborn avatar

Stargazers

 avatar  avatar

Watchers

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