Maria Map Maker CLI: Difference between revisions
No edit summary |
(→) |
||
Line 46: | Line 46: | ||
* <code>displayname</code> | * <code>displayname</code> | ||
* <code>displayversion</code> | * <code>displayversion</code> | ||
* <code>source</code> | |||
* <code>previewimage</code> | * <code>previewimage</code> | ||
* <code>description</code> | * <code>description</code> |
Revision as of 09:02, 21 May 2024
From version 4.4
MariaMapMakerCLI (command line interface) is a tool to create and update products and datasets. It offers a subset of the functionality of Maria Map Maker. It can be used in scripts to automate the process of frequently updating datasets. It can also be integrated into other systems to produce Maria GDK compatible products and datasets.
The tool is distributed with the main Maria Map Maker application.
Commands
The tool divides functionality into 4 main commands. Each of these have a set of options, listed below. All commands and options are case insensitive. To see an overview of all commands, run MariaMapMakerCLI.exe without any arguments.
New-Product
Create a new product. This command should write the full path to the new product, as well as its product ID, to StdOut, so it can be piped to a subsequent command.
-n
, --name
The name of the new product.
-p
, --path
Path where the new product will be created.
-pmd
, --productmetadata
Product metadata. Enter a valid product metadata key and value on the form -pmd "key=value"
. Valid keys are:
displayname
displayversion
previewimage
description
virtualpath
Update-Product
Update the metadata of a product, or change its status. The command should write the full path to the updated product, as well as its product ID, to StdOut, so it can be piped to a subsequent command.
-p
, --path
Path to a valid product to update, or the path to a workspace containing products. If the path is a workspace, then option --productid
must also be specified.
-id
, --productid
The product ID to update. Requires that --path
is specified to a workspace containing the specified product ID.
-pmd
, --productmetadata
Product metadata. Enter a valid product metadata key and value on the form -pmd "key=value"
. Valid keys are:
displayname
displayversion
source
previewimage
description
virtualpath
-s
, --setstatus
Set the status of the product to draft
or released
.
-m
, --generatemanifest
Generate a new manifest in the product. This can be done on a released product without changing its status. Valid values are true
or false
. Default true
.
-acl
, --generateacl
Generate a new accompanying letter with a summary of the product content. This can be done on a released product without changing its status. Valid values are true
or false
. Default true
.
New-Dataset
Create a new dataset by importing a georeferenced dataset. The MapPreparation add-in will be used to convert the source data to the selected output format. An overlay referencing the dataset will also be created.
-n
, --name
The name of the new dataset.
-p
, --path
Path to a valid product to create the dataset in, or the path to a workspace containing products. If the path is a workspace, then option --productid
must also be specified.
-id
, --productid
The product ID to create a new dataset in. Requires that --path
is specified to a workspace containing the specified product ID.
-s
, --sourcedata
File or directory containing supported georeferenced data to import.
-dmd
, --datasetmetadata
Dataset metadata. Enter a metadata key and value on the form -dmd "key=value"
.
-ps, --prepscript
The MapPreparation script to use when importing the data. The names are found in the displayname attribute in the MapPreparation script XML's. Default behaviour is to use the first valid script for the chosen source data.
-pp, --prepparam
The value of a parameter for the chosen --prepscript
. Should be on the form --prepparam "key=value"
.
-i, --includesourcedata
Include the source data in a sub-folder "sourcedata" in the dataset folder. This folder will always be cleaned out before updating a dataset. Valid values are true
or false
. Default is false
.
--addto
The type of template to create for the dataset. An overlay referencing the dataset will also be created. Valid values are 'overlay', 'basemap' and 'none'. Default is 'overlay'.
--elevationdatatype
The elevation data type. Valid values are 'undefined', 'terrainmodel', 'surfacemodel' and 'bathymetry'. Default is 'surfacemodel'.
--tags
Comma separated list of text tags applicable to elevation data only.
Update-Dataset
Import source data, overwriting the data file in an existing dataset. This command shares many of the options of the New-Dataset
command.
--signature
The unique map signature of the dataset to update.
-p
, --path
Path to a valid product where the specified dataset can be found. If the path is a workspace, then option --productid
must also be specified.
-id
, --productid
The product ID where the specified dataset can be found. Requires that --path
is specified to a workspace containing the specified product ID.
-s
, --sourcedata
File or directory containing supported georeferenced data to import.
-dmd
, --datasetmetadata
Dataset metadata. Enter a metadata key and value on the form -dmd key=value
.
--prepscript
The MapPreparation script to use when importing the data. The names are found in the displayname attribute in the MapPreparation script XML's. Default behaviour is to use the first valid script for the chosen source data.
--prepparam
The value of a parameter for the chosen --prepscript
. Should be on the form --prepparam "key=value"
.
--includesourcedata
Include the source data in a sub-folder "sourcedata" in the dataset folder. This folder will always be cleaned out before updating a dataset. Valid values are true
or false
. Default is false
.
--elevationdatatype
The elevation data type. Valid values are 'undefined', 'terrainmodel', 'surfacemodel' and 'bathymetry'. Default is 'surfacemodel'.
--tags
Comma separated list of text tags applicable to elevation data only.
Exit codes
Exit codes are output from MariaMapMakerCLI to indicate the result of the command.
Code | Description |
---|---|
0 | OK |
1 | Command options error |
2 | Unknown product |
3 | Service error |
4 | Service settings error |
5 | Illegal operation on released product |
6 | Unknown error |
Examples
Create a new product and then import a dataset into it:
MariaMapMakerCLI.exe New-Product --name "AIRAC export" -pmd "displayversion=2023-04" -pmd "virtualpath=Norway\Aeronautical" -pmd "previewimage=c:\work\airac_preview.png" --path "c:\myproduct\"
MariaMapMakerCLI.exe New-Dataset --path "c:\myproduct\AIRAC_export_v1_asf45345" --sourcedata "c:\srcfiles\airac\airac.tif" -dmd "datadate=2023-04-15" -dmd "description=Aearonautical charts covering Norway"
Set a released product to "Draft", update a dataset, and set to "Released":
MariaMapMakerCLI.exe Update-Product --path "c:\products\" --productid "9075c2fb-ef9f-4300-9008-83f4ecef0ec5" --setstatus "draft"
MariaMapMakerCLI.exe Update-Dataset --path "c:\products\" --productid "9075c2fb-ef9f-4300-9008-83f4ecef0ec5" --signature "IskantSat_456afe46346" --sourcedata "c:\iskant-2023-05-20.tif" -dmd "datadate=2023-05-20" --prepscript "Geopackage (Scale to 8bit)" --prepparam "nodata=255 255 252" --includesourcedata "true"
MariaMapMakerCLI.exe Update-Product --path "c:\products\" --productid "9075c2fb-ef9f-4300-9008-83f4ecef0ec5" --setstatus "released" -pmd "displayversion=2023-05"
The following example is a Powershell script which sets a specified product to "Draft", updates each dataset with new data, updates metadata, and finally sets the product to "Released".
$m3cli = "MariaMapMakerCLI.exe"
$productpath = "F:\workspace\NorwayTopo-update-test\NorwayTopoRaster_v32_859f2d06"
# Hashtable of map signatures in the product and corresponding source data folder
$updates = @{ N5000 = "F:\Geotiff_hovedkartserien\N5000 Raster TIFF-format";
N2000 = "F:\Geotiff_hovedkartserien\N2000 Raster TIFF-format";
N1000 = "F:\Geotiff_hovedkartserien\N1000 Raster TIFF-format";
N500 = "F:\Geotiff_hovedkartserien\N500 Raster TIFF-format";
N250 = "F:\Geotiff_hovedkartserien\N250 Raster TIFF-format";}
# Set product to draft. This command returns two values:
# the new product path [0] and the product ID [1].
[array]$product = . $m3cli Update-Product --setstatus "draft"
# Update each dataset in turn
foreach($signature in $updates.Keys)
{
Write-host "Updating $signature with data from $($updates[$signature])"
. $m3cli Update-Dataset `
--path $product[0] `
--sourcedata $($updates[$signature]) `
--prepparam "nodata=255 255 252" `
--prepparam "tile_format=PNG8" `
--datasetmetadata "datadate=2023-11-01" `
--datasetmetadata "metadatadate=2023-11-15"
}
# Update product metadata and release
. $m3cli Update-Product --path $product[0] --productmetadata "displayversion=2023-11"
. $m3cli Update-Product --path $product[0] --setstatus "released"