Giter Club home page Giter Club logo

gdal-tiler's Introduction

GDAL Tiler

...a product of:

Spatialised (http://spatialised.net); and 2Pi Software (http://2pisoftware.com)

Overview

GDAL Tiler is a set of python scripts which produces slippy map tiles from high resolution airborne orthophotos. It was wholly funded by the Australian Capital Territory Emergency Services Agency (https://esa.act.gov.au), who required a method for making slippy map tiles to fit a bespoke gridding arrangement used by an offline mapping application.

It seeks to act as an appliance which ingests imagery at one end, and produces map tiles in a bespoke gridding schema at the other.

It relies on GDAL's Python API, and the Python geospatial library Shapely. Using GDAL's virtual mosaic format, GDAL Tiler uses a delayed compute strategy to process pixel data at the last moment. This is relatively compute-intensive, at the saving of storage and the advantage of only resampling each orthophoto once between the raw data and the output tile.

gdal2tiles.py (https://gdal.org/programs/gdal2tiles.html) is an obvious parent to this codebase - initially we started looking at adding custom tiling schemas there. However, the approach we arrived at seemed to fall out more easily - and importantly, the whole team could understand the mechanics.

We think the cleverest part of how all this operates is taking advantage of GDAL's virtual raster format and virtual filesystem drivers. It is possible to deploy this whole system in a cloud environment without machinery needing local storage. The flexible tiling structure might also be clever but we're not sure yet!

We hope you can find ways to make it better - feel free to make pull requests; and if you see any issues we missed around licensing or attribution for existing works please let us know. We want to make sure that we acknowledge all of the giants on whose shoulders we stand.

Important caveat

This code is released as-is without warranty. Use at your own risk!

Neither Spatialised, 2Pi Software or the ACT Government offer any guarantee that it will work for you.

2Pi Software (https://2pisoftware.com) offer consulting on batch compute deployment of this code in AWS; and Spatialised (https://spatialised.net) offers consulting on modification of any of the geospatial components.

Operation

GDAL Tiler has three stages, which broadly reflect a manual process. These steps were determined because the first two are fast and relatively light - whereas the last is compute-intensive and long.

Step 1: index orthophotos

The first task is to create an index of incoming aerial imagery bounds. Often aerial imagery comes with a boundary index - this step was introduced to ensure reliable delivery of parameters required for later stages.

It uses buildimageindex.py. Input is a directory of orthophotos, and output is a GeoJSON-like index file. Image bounds are expressed in their native coordinates; where GeoJSON strictly requires latitudes and longitides expressed in a WGS84 geodetic system.

Using native coordinates allows for a single coordinate transformation to occur in the next step.

Step 2: build virtual mosaics

The ACT ESA tiling schema relies on a 'map grid square' index, dividing a region into 0.1 x 0.1 degree squares. These correspond exactly with the coverage of a single map tile at zoom level 11.

Using this index of map grid squares, we assemble a virtual mosaic for each one using buildmosaics.py. This grid should be infinitely flexbile, however the capacity to build whatever tiling schemes we like has not been tested.

tilecutter.py

creates slippy map tiles from virtual mosaics created by buildmosaics.py

required inputs

-i [string]; --inputmosaic: full path to a warped virtual mosaic created by buildmosaics.py

-o [string]; --outputtilestore: the full path to a base directory for placing output tiles

-z [string]; --zoomlevel: the zoom level to be processed

-g [string]; --gridconfiguration: path to a JSON file containing map grid and dataset boundary information. An example is found in the resources directory as gridconfiguration.json

optional inputs

-t [string]; --tilesize: output tile size

Outputs

  • a directory of slippy map tiles as 256 x 256 pixel PNG images for the given zoom level.

Usage

run a single tile zoom level

python3 ./tilecutter.py -i /mnt/bigdata/ACT-image-processing-2019/mosaics/212-maxzoom19-warped.vrt -o ../tilecutter2/zl17 -z 17 -g ./resources/gridconfiguration.json

gdal-tiler's People

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.