ImageGeneration is a tool for retreiving layers present in a WASDI workspace in various different formats. With this tool you are able to stack one or more layer over the other and to set a background map layer from using different providers. As it is a WASDI processor it uses the WASDI library that can be found at https://github.com/fadeoutsoftware/WASDI
ImageGeneration depends on several packages, which should be installed automatically. The packages required for the correct execution are the following:
- wasdi
- gdal
- owslib
- geotiler
- uuid
All the above packages are available via pip or conda. To install any of them, run the command:
pip install <name of the package>
To run some examples, further packages may be required. If an example requires a specific package, it will be detailed in the example directory.
The documentation related to the wasdi package can be found at https://wasdi.readthedocs.io/en/latest/index.html.
To utilize the Image Generation as a WASDI processor, it is essential to have a WASDI account, as the application requires authentication. To set up the application, you must complete the configuration in the "config.json" file by providing your corresponding account credentials and the name of the workspace you are working on.
{
"USER": "YOUR USERNAME",
"PASSWORD": "YOUR PASSWORD",
"PARAMETERSFILEPATH": "./params.json",
"WORKSPACE": "WORKSPACE NAME"
}
ImageGeneration as a WASDI processor requires a params.json file that contains all the parameters. There are many parameters supported:
- A list of products which represent each layer present in a WASDI workspace.
- Each layer has different options:
{
"PRODUCT": "lulc_map.tif",
"BAND": "band_1",
"BBOX": "",
"STYLE": "",
"FILENAME": "",
"GEOSERVER URL": "",
"LAYER ID": "",
"stack_order": 1
}
- product: Identifier for a product inside the WASDI workspace
- band: Identifier for the band of the product
- bbox: Bbox options used for selecting an area in the world
- style: Name of a sld style file present on a WASDI workspace
- fileName: Name of the output image
- geoserver url: Link for a custom geoserver url
- layer id: Identifier of a layer in a Geoserver workspace
- stack order: Order on which we want to stack layers
- A series of options for retreiving images:
"CRS": "",
"WIDTH": "",
"HEIGHT": 700,
"outputFormat": "jpeg",
"backgroundService" : "osm",
"stackLayers": true,
"bboxOptions": 1
- crs: Coordinate Reference System used. The list of crs options are the one supported by GeoServer
- width: Width of the image
- height: Height of the image
- output format: Format for the output image
- background service: Option for the tile provider
- stack layers: Boolean for selecting if stacking layers (true by default)
- bbox options: Integer for selecting the bbox options
The formats for the output images are the ones supported by GeoServer.
Format | Syntax | Notes |
---|---|---|
PNG | format=image/png |
Default PNG format for images. |
PNG8 | format=image/png8 |
Same as PNG, but with an optimal 256-color (8-bit) palette for smaller image sizes. |
JPEG | format=image/jpeg |
JPEG image format. |
JPEG-PNG | format=image/vnd.jpeg-png |
A custom format that dynamically decides between JPEG and PNG compression based on image contents. Requires &transparent=TRUE parameter for meaningful use. |
JPEG-PNG8 | format=image/vnd.jpeg-png8 |
Similar to JPEG-PNG but generates a paletted output if PNG format is chosen. |
GIF | format=image/gif |
GIF image format. |
TIFF | format=image/tiff |
TIFF image format. |
TIFF8 | format=image/tiff8 |
Similar to TIFF, but with an optimal 256-color (8-bit) palette for smaller image sizes. |
GeoTIFF | format=image/geotiff |
Similar to TIFF, but includes extra GeoTIFF metadata. |
GeoTIFF8 | format=image/geotiff8 |
Similar to GeoTIFF but with an optimal 256-color (8-bit) palette for smaller image sizes and extra GeoTIFF metadata. |
SVG | format=image/svg |
SVG image format. |
format=application/pdf |
PDF document format. | |
GeoRSS | format=rss |
GeoRSS format. |
KML | format=kml |
KML format, often used for geographic data in applications like Google Earth. |
KMZ | format=kmz |
KMZ format, a compressed version of KML. |
OpenLayers | format=application/openlayers |
Generates an OpenLayers HTML application, likely for displaying geospatial data. |
UTFGrid | format=application/json;type=utfgrid |
Generates an UTFGrid 1.3 JSON response, typically for vector data output. |
For the bbox options you can choose between intersection, union, and then one of the bboxes of a specific product.
bboxOptions | Notes |
---|---|
0 | Using the intersection of BBoxes. |
1 | Using the union of BBoxes. |
else | Using the bbox of the base layer. |
The parameter backgroundService is used to choose between the different tile providers supported by GeoTiler.
Provider | Provider Id | API Key Reference | License |
---|---|---|---|
OpenStreetMap | osm | Open Data Commons Open Database License | |
Stamen Toner | stamen-toner | Creative Commons Attribution (CC BY 3.0) license | |
Stamen Toner Lite | stamen-toner-lite | as above | |
Stamen Terrain | stamen-terrain | as above | |
Stamen Terrain Background | stamen-terrain-background | as above | |
Stamen Terrain Lines | stamen-terrain-lines | as above | |
Stamen Water Color | stamen-watercolor | as above | |
Modest Maps Blue Marble | bluemarble | NASA guideline | |
OpenCycleMap | thunderforest-cycle | thunderforest | Thunderforest Terms and Conditions |
N.B. A map provider might require API key. To add an API key for a map provider, the $HOME/.config/geotiler/geotiler.ini file has to be created with API key reference pointing to an API key, for example:
[api-key]
thunderforest = <api-key>
where is usually a fixed size, alphanumeric hash value provided by map provider service.
For the full documentation of GeoTiler check https://wrobell.dcmod.org/geotiler/usage.html.