{"id":21820008,"url":"https://github.com/ngageoint/geopackage-android-map","last_synced_at":"2025-04-14T02:41:45.451Z","repository":{"id":57736807,"uuid":"79610848","full_name":"ngageoint/geopackage-android-map","owner":"ngageoint","description":"GeoPackage Android Map Library","archived":false,"fork":false,"pushed_at":"2024-04-05T12:33:14.000Z","size":24463,"stargazers_count":33,"open_issues_count":0,"forks_count":7,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-27T16:41:48.122Z","etag":null,"topics":["android","android-library","android-sdk","geopackage","geopackage-android","geopackage-functionality","geopackage-libraries","geopackage-mapcache","geopackage-tiles","nga"],"latest_commit_sha":null,"homepage":"http://ngageoint.github.io/geopackage-android-map","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":"2017-01-20T23:55:43.000Z","updated_at":"2024-04-04T02:58:00.000Z","dependencies_parsed_at":"2024-11-27T16:45:25.034Z","dependency_job_id":null,"html_url":"https://github.com/ngageoint/geopackage-android-map","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fgeopackage-android-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fgeopackage-android-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fgeopackage-android-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Fgeopackage-android-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ngageoint","download_url":"https://codeload.github.com/ngageoint/geopackage-android-map/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248812219,"owners_count":21165387,"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":["android","android-library","android-sdk","geopackage","geopackage-android","geopackage-functionality","geopackage-libraries","geopackage-mapcache","geopackage-tiles","nga"],"created_at":"2024-11-27T16:27:57.234Z","updated_at":"2025-04-14T02:41:45.427Z","avatar_url":"https://github.com/ngageoint.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GeoPackage Android Map\n\n### GeoPackage Android Map Lib ####\n\nThe [GeoPackage Libraries](http://ngageoint.github.io/GeoPackage/) were 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[GeoPackage Android Map](http://ngageoint.github.io/geopackage-android-map/) is a [GeoPackage Library](http://ngageoint.github.io/GeoPackage/) SDK implementation of the Open Geospatial Consortium [GeoPackage](http://www.geopackage.org/) [spec](http://www.geopackage.org/spec/).  It is listed as an [OGC GeoPackage Implementation](http://www.geopackage.org/#implementations_nga) by the National Geospatial-Intelligence Agency.\n\nThe GeoPackage Android Map SDK provides Google Map library implementations in addition to the inherited base [GeoPackage Android](https://github.com/ngageoint/geopackage-android/) functionality.  The library provides TileProvider overlay implementations and Google Map shape translations.\n\n\u003ca href='https://www.ogc.org/resource/products/details/?pid=1732'\u003e\n    \u003cimg src=\"https://github.com/ngageoint/GeoPackage/raw/master/docs/images/ogc.gif\" height=50\u003e\n\u003c/a\u003e\n\n### Usage ###\n\nView the latest [Javadoc](http://ngageoint.github.io/geopackage-android-map/docs/api/)\n\n#### Implementations ####\n\n##### GeoPackage MapCache #####\n\nThe [GeoPackage MapCache](https://github.com/ngageoint/geopackage-mapcache-android) app provides an extensive standalone example on how to use the SDK.\n\n##### MAGE #####\n\nThe [Mobile Awareness GEOINT Environment (MAGE)](https://github.com/ngageoint/mage-android) app provides mobile situational awareness capabilities. It [uses the SDK](https://github.com/ngageoint/mage-android/search?q=GeoPackage\u0026type=Code) to provide GeoPackage functionality.\n\n#### Example ####\n\n```java\n\n// Context context = ...;\n// File geoPackageFile = ...;\n// GoogleMap map = ...;\n\n// Get a manager\nGeoPackageManager manager = GeoPackageFactory.getManager(context);\n\n// Import database\nboolean imported = manager.importGeoPackage(geoPackageFile);\n\n// Available databases\nList\u003cString\u003e databases = manager.databases();\n\n// Open database\nGeoPackage geoPackage = manager.open(databases.get(0));\n\n// GeoPackage Table DAOs\nSpatialReferenceSystemDao srsDao = geoPackage.getSpatialReferenceSystemDao();\nContentsDao contentsDao = geoPackage.getContentsDao();\nGeometryColumnsDao geomColumnsDao = geoPackage.getGeometryColumnsDao();\nTileMatrixSetDao tileMatrixSetDao = geoPackage.getTileMatrixSetDao();\nTileMatrixDao tileMatrixDao = geoPackage.getTileMatrixDao();\nSchemaExtension schemaExtension = new SchemaExtension(geoPackage);\nDataColumnsDao dao = schemaExtension.getDataColumnsDao();\nDataColumnConstraintsDao dataColumnConstraintsDao = schemaExtension\n        .getDataColumnConstraintsDao();\nMetadataExtension metadataExtension = new MetadataExtension(geoPackage);\nMetadataDao metadataDao = metadataExtension.getMetadataDao();\nMetadataReferenceDao metadataReferenceDao = metadataExtension\n        .getMetadataReferenceDao();\nExtensionsDao extensionsDao = geoPackage.getExtensionsDao();\n\n// Feature and tile tables\nList\u003cString\u003e features = geoPackage.getFeatureTables();\nList\u003cString\u003e tiles = geoPackage.getTileTables();\n\n// Query Features\nString featureTable = features.get(0);\nFeatureDao featureDao = geoPackage.getFeatureDao(featureTable);\nGoogleMapShapeConverter converter = new GoogleMapShapeConverter(\n        featureDao.getProjection());\nFeatureCursor featureCursor = featureDao.queryForAll();\ntry {\n    for (FeatureRow featureRow : featureCursor) {\n        GeoPackageGeometryData geometryData = featureRow.getGeometry();\n        if (geometryData != null \u0026\u0026 !geometryData.isEmpty()) {\n            Geometry geometry = geometryData.getGeometry();\n            GoogleMapShape shape = converter.toShape(geometry);\n            GoogleMapShape mapShape = GoogleMapShapeConverter\n                    .addShapeToMap(map, shape);\n            // ...\n        }\n    }\n} finally {\n    featureCursor.close();\n}\n\n// Query Tiles\nString tileTable = tiles.get(0);\nTileDao tileDao = geoPackage.getTileDao(tileTable);\nTileCursor tileCursor = tileDao.queryForAll();\ntry {\n    for (TileRow tileRow : tileCursor) {\n        byte[] tileBytes = tileRow.getTileData();\n        Bitmap tileBitmap = tileRow.getTileDataBitmap();\n        // ...\n    }\n} finally {\n    tileCursor.close();\n}\n\n// Retrieve Tiles by XYZ\nGeoPackageTileRetriever retriever = new GeoPackageTileRetriever(tileDao);\nGeoPackageTile geoPackageTile = retriever.getTile(2, 2, 2);\nif (geoPackageTile != null) {\n    byte[] tileBytes = geoPackageTile.getData();\n    Bitmap tileBitmap = geoPackageTile.getBitmap();\n    // ...\n}\n\n// Retrieve Tiles by Bounding Box\nTileCreator tileCreator = new TileCreator(\n        tileDao, ProjectionFactory.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM));\nGeoPackageTile geoPackageTile2 = tileCreator.getTile(\n        new BoundingBox(-90.0, 0.0, 0.0, 66.513260));\nif (geoPackageTile2 != null) {\n    byte[] tileBytes = geoPackageTile2.getData();\n    Bitmap tileBitmap = geoPackageTile2.getBitmap();\n    // ...\n}\n\n// Tile Provider (GeoPackage or Google API)\nTileProvider overlay = GeoPackageOverlayFactory\n        .getTileProvider(tileDao);\nTileOverlayOptions overlayOptions = new TileOverlayOptions();\noverlayOptions.tileProvider(overlay);\noverlayOptions.zIndex(-1);\nmap.addTileOverlay(overlayOptions);\n\nBoundingBox boundingBox = BoundingBox.worldWebMercator();\nProjection projection = ProjectionFactory\n        .getProjection(ProjectionConstants.EPSG_WEB_MERCATOR);\n\n// Index Features\nFeatureIndexManager indexer = new FeatureIndexManager(context, geoPackage, featureDao, false);\nindexer.setIndexLocation(FeatureIndexType.GEOPACKAGE);\nint indexedCount = indexer.index();\n\n// Query Indexed Features in paginated chunks\nFeatureIndexResults indexResults = indexer.queryForChunk(boundingBox,\n        projection, 50);\nFeaturePaginatedCursor paginatedCursor = indexer\n        .paginate(indexResults);\nfor (FeatureRow featureRow : paginatedCursor) {\n    GeoPackageGeometryData geometryData = featureRow.getGeometry();\n    if (geometryData != null \u0026\u0026 !geometryData.isEmpty()) {\n        Geometry geometry = geometryData.getGeometry();\n        // ...\n    }\n}\n\n// Feature Tile Provider (dynamically draw tiles from features)\nFeatureTiles featureTiles = new DefaultFeatureTiles(context, featureDao, context.getResources().getDisplayMetrics().density, false);\nfeatureTiles.setMaxFeaturesPerTile(1000); // Set max features to draw per tile\nNumberFeaturesTile numberFeaturesTile = new NumberFeaturesTile(context); // Custom feature tile implementation\nfeatureTiles.setMaxFeaturesTileDraw(numberFeaturesTile); // Draw feature count tiles when max features passed\nfeatureTiles.setIndexManager(indexer); // Set index manager to query feature indices\nFeatureOverlay featureOverlay = new FeatureOverlay(featureTiles);\nfeatureOverlay.setMinZoom(featureDao.getZoomLevel()); // Set zoom level to start showing tiles\nTileOverlayOptions featureOverlayOptions = new TileOverlayOptions();\nfeatureOverlayOptions.tileProvider(featureOverlay);\nfeatureOverlayOptions.zIndex(-1); // Draw the feature tiles behind map markers\nmap.addTileOverlay(featureOverlayOptions);\n\n// URL Tile Generator (generate tiles from a URL)\nTileGenerator urlTileGenerator = new UrlTileGenerator(context, geoPackage,\n        \"url_tile_table\", \"http://url/{z}/{x}/{y}.png\", 0, 0, boundingBox, projection);\nint urlTileCount = urlTileGenerator.generateTiles();\n\n// Feature Tile Generator (generate tiles from features)\nTileGenerator featureTileGenerator = new FeatureTileGenerator(context, geoPackage,\n        \"tiles_\" + featureTable, featureTiles, 1, 2, boundingBox, projection);\nint featureTileCount = featureTileGenerator.generateTiles();\n\n// Close feature tiles (and indexer)\nfeatureTiles.close();\n\n// Close database when done\ngeoPackage.close();\n\n```\n\n### Installation ###\n\nPull from the [Maven Central Repository](http://search.maven.org/#artifactdetails|mil.nga.geopackage.map|geopackage-android-map|6.7.4|aar) (AAR, POM, Source, Javadoc)\n\n    api 'mil.nga.geopackage.map:geopackage-android-map:6.7.4'\n\n### Build ###\n\n[![Build Artifacts](https://github.com/ngageoint/geopackage-android-map/workflows/Build%20Artifacts/badge.svg)](https://github.com/ngageoint/geopackage-android-map/actions/workflows/build-artifacts.yml)\n[![Test](https://github.com/ngageoint/geopackage-android-map/workflows/Test/badge.svg)](https://github.com/ngageoint/geopackage-android-map/actions/workflows/test.yml)\n\nBuild this repository using Android Studio and/or Gradle.\n\n#### Project Setup ####\n\nInclude as repositories in your project build.gradle:\n\n    repositories {\n        google()\n        mavenCentral()\n        mavenLocal()\n    }\n\n##### Normal Build #####\n\nInclude the dependency in your module build.gradle with desired version number:\n\n    api 'mil.nga.geopackage.map:geopackage-android-map:6.7.4'\n\nAs part of the build process, run the \"publishToMavenLocal\" task on the geopackage-map Gradle script to update the Maven local repository.\n\n##### Local Build #####\n\nReplace the normal build dependency in your module build.gradle with:\n\n    api project(':geopackage-map')\n\nInclude in your settings.gradle:\n\n    include ':geopackage-map'\n\nFrom your project directory, link the cloned SDK directory:\n\n    ln -s ../geopackage-android-map/geopackage-map geopackage-map\n\n### Remote Dependencies ###\n\n* [GeoPackage Android](https://github.com/ngageoint/geopackage-android) (The MIT License (MIT)) - GeoPackage Android Lib\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngageoint%2Fgeopackage-android-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fngageoint%2Fgeopackage-android-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngageoint%2Fgeopackage-android-map/lists"}