{"id":21819959,"url":"https://github.com/ngageoint/gars-ios","last_synced_at":"2025-09-12T03:48:28.233Z","repository":{"id":58735578,"uuid":"512831685","full_name":"ngageoint/gars-ios","owner":"ngageoint","description":"Global Area Reference System iOS Library","archived":false,"fork":false,"pushed_at":"2024-04-08T14:57:02.000Z","size":1752,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-27T16:42:00.231Z","etag":null,"topics":["cocoapods","gars","global-area-reference-system","ios","nga","swift","xcode"],"latest_commit_sha":null,"homepage":"https://ngageoint.github.io/gars-ios/","language":"Swift","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","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":"2022-07-11T16:28:58.000Z","updated_at":"2023-01-26T13:16:55.000Z","dependencies_parsed_at":"2024-12-01T06:46:55.316Z","dependency_job_id":null,"html_url":"https://github.com/ngageoint/gars-ios","commit_stats":{"total_commits":60,"total_committers":2,"mean_commits":30.0,"dds":0.08333333333333337,"last_synced_commit":"1221cc4e9aa6ff8ab56693a9652685552b838f29"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fgars-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fgars-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fgars-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fgars-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ngageoint","download_url":"https://codeload.github.com/ngageoint/gars-ios/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248766685,"owners_count":21158302,"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":["cocoapods","gars","global-area-reference-system","ios","nga","swift","xcode"],"created_at":"2024-11-27T16:27:28.473Z","updated_at":"2025-09-12T03:48:28.217Z","avatar_url":"https://github.com/ngageoint.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GARS iOS\n\n#### Global Area Reference System Lib ####\n\nThe GARS 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[GARS](http://ngageoint.github.io/gars-ios/) is a Swift library providing Global Area Reference System functionality, a standardized geospatial reference system for areas.  [GARS App](https://github.com/ngageoint/gars-ios/tree/master/app) is a map implementation utilizing this library.\n\n### Usage ###\n\nView the latest [Appledoc](http://ngageoint.github.io/gars-ios/docs/api/)\n\n#### Import ####\n\n```swift\n\nimport GARS\n\n```\n\n#### Coordinates ####\n\n```swift\n\nlet gars = GARS.parse(\"006AG39\")\nlet point = gars.toPoint()\nlet pointMeters = point.toMeters()\n\nlet latitude = 63.98862388\nlet longitude = 29.06755082\nlet point2 = GridPoint(longitude, latitude)\nlet gars2 = GARS.from(point2)\nlet garsCoordinate = gars2.description\nlet gars30m = gars2.coordinate(GridType.THIRTY_MINUTE)\nlet gars15m = gars2.coordinate(GridType.FIFTEEN_MINUTE)\nlet gars5m = gars2.coordinate(GridType.FIVE_MINUTE)\n\n```\n\n#### Tile Overlay ####\n\n```swift\n\n// let mapView: MKMapView = ...\n\n// Tile size determined from display density\nlet tileOverlay = GARSTileOverlay()\n\n// Manually specify tile size\nlet tileOverlay2 = GARSTileOverlay(512, 512)\n\n// Specified grids\nlet customTileOverlay = GARSTileOverlay(\n        [GridType.THIRTY_MINUTE, GridType.FIFTEEN_MINUTE])\n\nmapView.addOverlay(tileOverlay)\n\n```\n\n#### Tile Overlay Options ####\n\n```swift\n\nlet tileOverlay = GARSTileOverlay()\n\nlet x = 8\nlet y = 12\nlet zoom = 5\n\n// Manually get a tile or draw the tile bitmap\nlet tile = tileOverlay.tile(x, y, zoom)\nlet tileImage = tileOverlay.drawTile(x, y, zoom)\n\nlet latitude = 63.98862388\nlet longitude = 29.06755082\nlet locationCoordinate = CLLocationCoordinate2DMake(latitude, longitude)\n\n// GARS Coordinates\nlet gars = tileOverlay.gars(locationCoordinate)\nlet coordinate = tileOverlay.coordinate(locationCoordinate)\nlet zoomCoordinate = tileOverlay.coordinate(locationCoordinate, zoom)\n\nlet gars30m = tileOverlay.coordinate(locationCoordinate, GridType.THIRTY_MINUTE)\nlet gars15m = tileOverlay.coordinate(locationCoordinate, GridType.FIFTEEN_MINUTE)\nlet gars5m = tileOverlay.coordinate(locationCoordinate, GridType.FIVE_MINUTE)\n\n```\n\n#### Custom Grids ####\n\n```swift\n\nlet grids = Grids()\n\ngrids.deletePropagatedStyles()\ngrids.disableTypes([GridType.TWENTY_DEGREE, GridType.TEN_DEGREE,\n        GridType.FIVE_DEGREE, GridType.ONE_DEGREE])\n\ngrids.setColor(GridType.THIRTY_MINUTE, UIColor.red)\ngrids.setWidth(GridType.THIRTY_MINUTE, 4.0)\ngrids.setMinZoom(GridType.THIRTY_MINUTE, 6)\n\ngrids.setLabelMinZoom(GridType.THIRTY_MINUTE, 6)\ngrids.setLabelTextSize(GridType.THIRTY_MINUTE, 32.0)\n\ngrids.setColor(GridType.FIFTEEN_MINUTE, UIColor.blue)\nlet lessThan15m = GridType.lessPrecise(GridType.FIFTEEN_MINUTE)\ngrids.setWidth(GridType.FIFTEEN_MINUTE, lessThan15m, 4.0)\ngrids.setColor(GridType.FIFTEEN_MINUTE, lessThan15m, UIColor.red)\n\ngrids.setLabelColor(GridType.FIVE_MINUTE, UIColor.orange)\ngrids.setLabelBuffer(GridType.FIVE_MINUTE, 0.1)\ngrids.setWidth(GridType.FIVE_MINUTE, lessThan15m, 4.0)\ngrids.setColor(GridType.FIVE_MINUTE, lessThan15m, UIColor.red)\ngrids.setColor(GridType.FIVE_MINUTE, GridType.FIFTEEN_MINUTE, UIColor.blue)\n\nlet tileOverlay = GARSTileOverlay(grids)\n\n```\n\n#### Draw Tile Template ####\n\n```swift\n\n// let tile: GridTile = ...\n\nlet grids = Grids()\n\nlet zoomGrids = grids.grids(tile.zoom)\nif zoomGrids.hasGrids() {\n\n    for grid in zoomGrids {\n\n        let lines = grid.lines(tile)\n        if lines != nil {\n            for line in lines! {\n                let pixel1 = line.point1.pixel(tile)\n                let pixel2 = line.point2.pixel(tile)\n                // Draw line\n            }\n        }\n\n        let labels = grid.labels(tile)\n        if labels != nil {\n            for label in labels! {\n                let pixelRange = label.bounds.pixelRange(tile)\n                let centerPixel = label.center.pixel(tile)\n                // Draw label\n            }\n        }\n\n    }\n}\n\n```\n\n#### Objective-C ####\n\n```objectivec\n\n#import \"GARS-Swift.h\"\n\n```\n\n```objectivec\n\nMKTileOverlay *tileOverlay = [[GARSTileOverlay alloc] init];\n[mapView addOverlay:tileOverlay];\n\n```\n\n### Build ###\n\n[![Build](https://github.com/ngageoint/gars-ios/workflows/Build/badge.svg)](https://github.com/ngageoint/gars-ios/actions/workflows/build.yml)\n\nBuild and Test (Uses UIKit, so we build with xcodebuild instead of SPM).\n\n    ./build.sh\n\nYou can build and test if you open the Package.swift in Xcode.\n\n\n### Include Library ###\n\nUse this library via SPM in your Package.swift:\n\n    dependencies: [\n        .package(url: \"https://github.com/ngageoint/gars-ios.git\", branch: \"release/2.0.0\"),\n    ]\n    \nOr as a tagged release:\n\n    dependencies: [\n        .package(url: \"https://github.com/ngageoint/gars-ios.git\", from: \"2.0.0\"),\n    ]\n\nReference it in your Package.swift target:\n\n    .target(\n        name: \"MyApp\",\n        dependencies: [\n            .product(name: \"GARS\", package: \"gars-ios\"),\n        ],\n    ),\n\n### Remote Dependencies ###\n\n* [Grid](https://github.com/ngageoint/grid-ios) (The MIT License (MIT)) - Grid Library\n\n### GARS App ###\n\nThe [GARS App](https://github.com/ngageoint/gars-ios/tree/master/app) provides a Global Area Reference System map using this library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngageoint%2Fgars-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fngageoint%2Fgars-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngageoint%2Fgars-ios/lists"}