@ngageoint/geopackage-mobile-optimizer
Utility to optimize a GeoPackage for use on mobile devices
Last updated 2 years ago by danielbarela .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @ngageoint/geopackage-mobile-optimizer 
SYNC missed versions from official npm registry.

@ngageoint/geopackage-mobile-optimizer — Optimize GeoPackages for mobile consumption

This utility will convert a GeoPackage into a GeoPackage which allows for friendly consumption on a web mercator mobile or web map. The utility will convert to EPSG:3857 and place tiles aligned with regular XYZ coordinates. This allows the clients to read the tiles from the tile tables without reprojecting or cropping.

Installation

NPM

$ npm install @ngageoint/geopackage-mobile-optimizer

Usage

Command Line

./mobile-optimizer /path/to/file/to/convert.gpkg /path/to/file/to/create.gpkg
var fs = require('fs');
var GeoPackageAPI = require('@ngageoint/geopackage');
var GeoPackageOptimizer = require("@ngageoint/geopackage-mobile-optimizer");

var geoPackageFile = '/path/to/file/to/convert.gpkg';
var outputGeoPackageFile = '/path/to/file/to/create.gpkg';

async.series({
  fileExists: function(callback) {
    fs.stat(geoPackageFile, function(err, stats) {
      if (err || !stats || !stats.isFile()) {
        return callback('File does not exist.');
      }
      return callback(null, true);
    });
  },
  geoPackage: function(callback) {
    GeoPackageAPI.openGeoPackage(geoPackageFile, function(err, result) {
      if (err || !result) {
        return callback('Invalid GeoPackage file.');
      }
      console.log('Processing %s', geoPackageFile);
      callback(null, result);
    });
  },
  outputGeoPackage: function (callback) {
    GeoPackageAPI.createGeoPackage(outputGeoPackageFile, function(err, result) {
      if (err || !result) {
        return callback('Invalid GeoPackage file.');
      }
      console.log('Writing mobile optimized GeoPackage to %s', outputGeoPackageFile);
      callback(null, result);
    });
  }
},
function(err, results) {
  if (err) {
    console.log('Failed to convert with error', err);
    process.exit(1);
  } else {
    GeoPackageOptimizer(results.geoPackage, results.outputGeoPackage, function(err) {
      console.log('Optimization Complete, optimized file: %s', outputGeoPackageFile);
      process.exit(0);
    });
  }
});
GeoPackageOptimizer(results.geoPackage, results.outputGeoPackage, function(err) {
  console.log('Optimization Complete, optimized file: %s', outputGeoPackageFile);
  process.exit(0);
});

GeoPackage JS Library

The GeoPackage Libraries were 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.

Changelog

1.0.0
  • Initial release.

Current Tags

  • 2.0.3                                ...           latest (2 years ago)

5 Versions

  • 2.0.3                                ...           2 years ago
  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 3
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |