Usage Instructions for tiles2gpkg_parallel.py - GitHubRGI/geopackage-python GitHub Wiki

Purpose

This document covers installation of dependencies, in-depth explanations of command-line arguments, and usage examples for tiles2gpkg parallel.py. The file tiles2gpkg parallel.py is a Python script that accepts a folder of tiles in TMS format (z/x/y) and outputs an Open Geospatial Consortium (OGC)- compliant Geopackage. The script leverages as much hardware capability as possible in order package this data. For more information about the OGC Specification for Geopackage, please visit the Open Geospatial Consortium Website: http://www.opengeospatial.org/standards/geopackage.

Installing Dependencies

Tiles2gpkg parallel.py was written for Python 2.7.x and has not been tested on any other version. It will run on either 32 or 64 bit systems with no issues. The script relies on the Python Imaging Library (PIL) in order to allow fine-grain control of the MIME type (PNG/JPEG) of each individual tile that resides within the output Geopackage. Without PIL, the script will simply detect the image type of the input tile and maintain that MIME type when it is stored to the Geopackage. Please see the wiki page for installing dependencies for more information.

Usage

Command Line Arguments

Tiles2gpkg parallel.py supports additional functionality via command line arguments provided to the script at the time it is executed. Following is a outline of each one and their purpose: -h Print the listing of commands available for this script. -tileorigin Specify the origin of the tiles contained within the input data folder. Gdal2tiles.py creates tiles referenced by the bottom-left corner by default, which follows TMS convention. Other tile providers can create tiles with a tile origin of upper-left. Valid options are ul, ll, nw, or sw. The default option is ll for lower-left. -srs Specify the spatial reference system of the tiles contained within the input data folder. This could also be called the tile grid profile. Valid options are 3857 (mercator), 4326 (geodetic), and 3395 (global mercator). The default value for this field is 3857.

-imagery Convert the MIME type of the tiles on-disk to a new type when they are stroed in the
         GeoPackage.  Valid options are source, mixed, png, and jpeg.  Specifying mixed mode will convert
         all tile images in the source folderthat do *not* have transparency to JPEG with compression
         enabled for space savings.  Specifying source mode will preserve the file type of the input
         tile images.  The default value for this field is source.

-q       When the -imagery flag is set to either mixed or jpeg, this flag specifies the jpeg quality
         value.  Acceptable values are from 1-100 inclusive.  Lower numbers result in smaller size images
         but greatly reduced image quality.

-T       By default, tiles2gpkg_parallel.py takes advantage of all the processors available to the
         hardware that it is executed on.  This can mean that other computing tasks on the machine may
         suffer depending on the size of the packaging job.  The -T flag disables this behavoir and only
         uses a single-core process to execute the job.

Examples

  • Create a geopackage from a folder of tiles named WhiteHorse in the geodetic tile profile, and name the new Geopackage whitehorse.gpkg:

      python tiles2gpkg_parallel.py -srs 4326 /data/tiles/geodetic/WhiteHorse /data/geopackage/whitehorse.gpkg
    
  • Create a geopackage from a folder of tiles named belvoir in the mercator profile and changing the tile images to a mix of PNG and JPEG images:

      python tiles2gpkg_parallel.py -srs 3857 -imagery mixed /data/tiles/mercator/belvoir /data/geopackage/belvoir-3857.gpkg
    
  • Create a geopackage from a folder of tiles named gnc in the world mercator profile with a tile origin of upper-left and also converting the tile images to JPEG with 50% quality:

      python tiles2gpkg_parallel.py -srs 3395 -tileorigin ul -imagery jpeg -q 50 /data/tiles/world-mercator/gnc /data/geopackage/gnc-wm.gpkg
    

Known Issues

Refer to the issues on this repository for an up-to-date listing of known issues and their status.

⚠️ **GitHub.com Fallback** ⚠️