{"id":21820011,"url":"https://github.com/ngageoint/mgrs-java","last_synced_at":"2025-04-14T02:41:32.362Z","repository":{"id":43777668,"uuid":"146495851","full_name":"ngageoint/mgrs-java","owner":"ngageoint","description":"Military Grid Reference System Java Library","archived":false,"fork":false,"pushed_at":"2024-04-03T20:45:37.000Z","size":1028,"stargazers_count":20,"open_issues_count":3,"forks_count":4,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-27T16:41:45.420Z","etag":null,"topics":["java","mgrs","military-grid-reference-system","nga"],"latest_commit_sha":null,"homepage":"https://ngageoint.github.io/mgrs-java/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ngageoint.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-28T19:19:39.000Z","updated_at":"2024-12-20T19:49:23.000Z","dependencies_parsed_at":"2024-04-03T21:45:27.332Z","dependency_job_id":null,"html_url":"https://github.com/ngageoint/mgrs-java","commit_stats":{"total_commits":112,"total_committers":2,"mean_commits":56.0,"dds":0.0982142857142857,"last_synced_commit":"1e15a2b1536013920ee9c7a6a4b2bede13797c46"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fmgrs-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fmgrs-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fmgrs-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fmgrs-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ngageoint","download_url":"https://codeload.github.com/ngageoint/mgrs-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248812189,"owners_count":21165383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","mgrs","military-grid-reference-system","nga"],"created_at":"2024-11-27T16:27:59.251Z","updated_at":"2025-04-14T02:41:32.340Z","avatar_url":"https://github.com/ngageoint.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MGRS Java\n\n#### Military Grid Reference System Lib ####\n\nThe MGRS Library was developed at the [National Geospatial-Intelligence Agency (NGA)](http://www.nga.mil/) in collaboration with [BIT Systems](https://www.caci.com/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](http://choosealicense.com/licenses/mit/).\n\n### Pull Requests ###\nIf 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.\n\nSoftware 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.\n\n### About ###\n\n[MGRS](http://ngageoint.github.io/mgrs-java/) is a Java library providing Military Grid Reference System functionality, a geocoordinate standard used by NATO militaries for locating points on Earth.\n\n### Usage ###\n\nView the latest [Javadoc](http://ngageoint.github.io/mgrs-java/docs/api/)\n\n#### Coordinates ####\n\n```java\n\nMGRS mgrs = MGRS.parse(\"33XVG74594359\");\nPoint point = mgrs.toPoint();\nPoint pointMeters = point.toMeters();\nUTM utm = mgrs.toUTM();\nString utmCoordinate = utm.toString();\nPoint point2 = utm.toPoint();\n\nMGRS mgrs2 = MGRS.parse(\"33X VG 74596 43594\");\n\ndouble latitude = 63.98862388;\ndouble longitude = 29.06755082;\nPoint point3 = Point.point(longitude, latitude);\nMGRS mgrs3 = MGRS.from(point3);\nString mgrsCoordinate = mgrs3.toString();\nString mgrsGZD = mgrs3.coordinate(GridType.GZD);\nString mgrs100k = mgrs3.coordinate(GridType.HUNDRED_KILOMETER);\nString mgrs10k = mgrs3.coordinate(GridType.TEN_KILOMETER);\nString mgrs1k = mgrs3.coordinate(GridType.KILOMETER);\nString mgrs100m = mgrs3.coordinate(GridType.HUNDRED_METER);\nString mgrs10m = mgrs3.coordinate(GridType.TEN_METER);\nString mgrs1m = mgrs3.coordinate(GridType.METER);\n\nUTM utm2 = UTM.from(point3);\nMGRS mgrs4 = utm2.toMGRS();\n\nUTM utm3 = UTM.parse(\"18 N 585628 4511322\");\nMGRS mgrs5 = utm3.toMGRS();\n\n```\n\n#### Draw Tile Template ####\n\nSee [mgrs-android](https://github.com/ngageoint/mgrs-android) for a concrete example\n\n```java\n\n// GridTile tile = ...;\n\nGrids grids = Grids.create();\n\nZoomGrids zoomGrids = grids.getGrids(tile.getZoom());\nif (zoomGrids.hasGrids()) {\n\n  GridRange gridRange = GridZones.getGridRange(tile.getBounds());\n\n  for (Grid grid : zoomGrids) {\n\n    // draw this grid for each zone\n    for (GridZone zone : gridRange) {\n\n      List\u003cGridLine\u003e lines = grid.getLines(tile, zone);\n      if (lines != null) {\n        PixelRange pixelRange = zone.getBounds()\n            .getPixelRange(tile);\n        for (GridLine line : lines) {\n          Pixel pixel1 = line.getPoint1().getPixel(tile);\n          Pixel pixel2 = line.getPoint2().getPixel(tile);\n          // Draw line\n        }\n      }\n\n      List\u003cGridLabel\u003e labels = grid.getLabels(tile, zone);\n      if (labels != null) {\n        for (GridLabel label : labels) {\n          PixelRange pixelRange = label.getBounds()\n              .getPixelRange(tile);\n          Pixel centerPixel = label.getCenter()\n              .getPixel(tile);\n          // Draw label\n        }\n      }\n\n    }\n  }\n}\n\n```\n\n#### Properties ####\n\nDefault grid properties including zoom ranges, styles, and labelers are defined in [mgrs.properties](https://github.com/ngageoint/mgrs-java/blob/master/src/main/resources/mgrs.properties). The defaults can be changed in code by modifying the [Grids](https://github.com/ngageoint/mgrs-java/blob/master/src/main/java/mil/nga/mgrs/grid/Grids.java).\n\n### Installation ###\n\nPull from the [Maven Central Repository](http://search.maven.org/#artifactdetails|mil.nga|mgrs|2.1.3|jar) (JAR, POM, Source, Javadoc)\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003emil.nga\u003c/groupId\u003e\n        \u003cartifactId\u003emgrs\u003c/artifactId\u003e\n        \u003cversion\u003e2.1.3\u003c/version\u003e\n    \u003c/dependency\u003e\n\n### Build ###\n\n[![Build \u0026 Test](https://github.com/ngageoint/mgrs-java/workflows/Build%20\u0026%20Test/badge.svg)](https://github.com/ngageoint/mgrs-java/actions/workflows/build-test.yml)\n\nBuild this repository using Eclipse and/or Maven:\n\n    mvn clean install\n\n### Remote Dependencies ###\n\n* [Grid Java](https://github.com/ngageoint/grid-java) (The MIT License (MIT)) - Grid Library\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngageoint%2Fmgrs-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fngageoint%2Fmgrs-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngageoint%2Fmgrs-java/lists"}