Maria Map Maker CLI: Difference between revisions

From Maria GDK Wiki
Jump to navigation Jump to search
()
()
 
(11 intermediate revisions by the same user not shown)
Line 11: Line 11:
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.
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.


<code>-n</code>, <code>--name</code>
==== <code>-n</code>, <code>--name</code> ====
 
The name of the new product.
The name of the new product.


<code>-p</code>, <code>--path</code>
==== <code>-p</code>, <code>--path</code> ====
 
Path where the new product will be created.
Path where the new product will be created.


<code>-pmd</code>, <code>--productmetadata</code>
==== <code>-pmd</code>, <code>--productmetadata</code> ====
 
Product metadata. Enter a valid product metadata key and value on the form <code>-pmd "key=value"</code>. Valid keys are:  
Product metadata. Enter a valid product metadata key and value on the form <code>-pmd "key=value"</code>. Valid keys are:  


Line 32: Line 29:
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.
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.


<code>-p</code>, <code>--path</code>
==== <code>-p</code>, <code>--path</code> ====
 
Path to a valid product to update, or the path to a workspace containing products. If the path is a workspace, then option <code>--productid</code> must also be specified.
Path to a valid product to update, or the path to a workspace containing products. If the path is a workspace, then option <code>--productid</code> must also be specified.


<code>-id</code>, <code>--productid</code>
==== <code>-id</code>, <code>--productid</code> ====
 
The product ID to update. Requires that <code>--path</code> is specified to a workspace containing the specified product ID.
The product ID to update. Requires that <code>--path</code> is specified to a workspace containing the specified product ID.


<code>-pmd</code>, <code>--productmetadata</code>
==== <code>-pmd</code>, <code>--productmetadata</code> ====
 
Product metadata. Enter a valid product metadata key and value on the form <code>-pmd "key=value"</code>. Valid keys are:  
Product metadata. Enter a valid product metadata key and value on the form <code>-pmd "key=value"</code>. Valid keys are:  


Line 51: Line 45:
* <code>virtualpath</code>
* <code>virtualpath</code>


<code>-s</code>, <code>--setstatus</code>
==== <code>-s</code>, <code>--setstatus</code> ====
 
Set the status of the product to <code>draft</code> or <code>released</code>.
Set the status of the product to <code>draft</code> or <code>released</code>.


<code>-m</code>, <code>--generatemanifest</code>
==== <code>-m</code>, <code>--generatemanifest</code> ====
 
Generate a new manifest in the product. This can be done on a released product without changing its status. Valid values are <code>true</code> or <code>false</code>. Default <code>true</code>.
Generate a new manifest in the product. This can be done on a released product without changing its status. Valid values are <code>true</code> or <code>false</code>. Default <code>true</code>.


<code>-acl</code>, <code>--generateacl</code>
==== <code>-acl</code>, <code>--generateacl</code> ====
 
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 <code>true</code> or <code>false</code>. Default <code>true</code>.
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 <code>true</code> or <code>false</code>. Default <code>true</code>.


Line 66: Line 57:
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.
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.


<code>-n</code>, <code>--name</code>
==== <code>-n</code>, <code>--name</code> ====
 
The name of the new dataset.
The name of the new dataset.


<code>-p</code>, <code>--path</code>
==== <code>-p</code>, <code>--path</code> ====
 
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 <code>--productid</code> must also be specified.
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 <code>--productid</code> must also be specified.


<code>-id</code>, <code>--productid</code>
==== <code>-id</code>, <code>--productid</code> ====
 
The product ID to create a new dataset in. Requires that <code>--path</code> is specified to a workspace containing the specified product ID.
The product ID to create a new dataset in. Requires that <code>--path</code> is specified to a workspace containing the specified product ID.


<code>-s</code>, <code>--sourcedata</code>
==== <code>-s</code>, <code>--sourcedata</code> ====
 
File or directory containing supported georeferenced data to import.
File or directory containing supported georeferenced data to import.


<code>-dmd</code>, <code>--datasetmetadata</code>
==== <code>-dmd</code>, <code>--datasetmetadata</code> ====
 
Dataset metadata. Enter a metadata key and value on the form <code>-dmd "key=value"</code>.
Dataset metadata. Enter a metadata key and value on the form <code>-dmd "key=value"</code>.


<code>-ps, --prepscript</code>
==== <code>-ps, --prepscript</code> ====
 
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.
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.


<code>-pp, --prepparam</code>
==== <code>-pp, --prepparam</code> ====
 
The value of a parameter for the chosen <code>--prepscript</code>. Should be on the form <code>--prepparam "key=value"</code>.
The value of a parameter for the chosen <code>--prepscript</code>. Should be on the form <code>--prepparam "key=value"</code>.


<code>-i, --includesourcedata</code>
==== <code>-i, --includesourcedata</code> ====
 
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 <code>true</code> or <code>false</code>. Default is <code>false</code>.
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 <code>true</code> or <code>false</code>. Default is <code>false</code>.


<code>--addto</code>
==== <code>--addto</code> ====
The type of template to create to reference the dataset. Valid values are <code>overlay</code>, <code>basemap</code> and <code>none</code>. Default is <code>overlay</code>.


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'.
==== <code>--elevationdatatype</code> ====
The elevation data type. Valid values are <code>undefined</code>, <code>terrainmodel</code>, <code>surfacemodel</code> and <code>bathymetry</code>. Default is <code>terrainmodel</code>.


<code>--elevationdatatype</code>
==== <code>--tags</code> ====
 
Comma separated list of text tags applicable to elevation data only.
The elevation data type. Valid values are 'undefined', 'terrainmodel', 'surfacemodel' and 'bathymetry'. Default is 'surfacemodel'.


<code>--tags</code>
==== <code>--epsg</code> ====
 
EPSG code of the source dataset if this information is not embedded.
Comma separated list of text tags applicable to elevation data only.


=== <code>Update-Dataset</code> ===
=== <code>Update-Dataset</code> ===
Import source data, overwriting the data file in an existing dataset. This command shares many of the options of the <code>New-Dataset</code> command.
Import source data, overwriting the data file in an existing dataset. This command shares many of the options of the <code>New-Dataset</code> command.


<code>--signature</code>
==== <code>--signature</code> ====
 
The unique map signature of the dataset to update.
The unique map signature of the dataset to update.


<code>-p</code>, <code>--path</code>
==== <code>-p</code>, <code>--path</code> ====
 
Path to a valid product where the specified dataset can be found. If the path is a workspace, then option <code>--productid</code> must also be specified.
Path to a valid product where the specified dataset can be found. If the path is a workspace, then option <code>--productid</code> must also be specified.


<code>-id</code>, <code>--productid</code>
==== <code>-id</code>, <code>--productid</code> ====
 
The product ID where the specified dataset can be found. Requires that <code>--path</code> is specified to a workspace containing the specified product ID.
The product ID where the specified dataset can be found. Requires that <code>--path</code> is specified to a workspace containing the specified product ID.


<code>-s</code>, <code>--sourcedata</code>
==== <code>-s</code>, <code>--sourcedata</code> ====
 
File or directory containing supported georeferenced data to import.
File or directory containing supported georeferenced data to import.


<code>-dmd</code>, <code>--datasetmetadata</code>
==== <code>-dmd</code>, <code>--datasetmetadata</code> ====
 
Dataset metadata. Enter a metadata key and value on the form <code>-dmd key=value</code>.
Dataset metadata. Enter a metadata key and value on the form <code>-dmd key=value</code>.


<code>--prepscript</code>
==== <code>--prepscript</code> ====
 
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.
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.


<code>--prepparam</code>
==== <code>--prepparam</code> ====
The value of a parameter for the chosen <code>--prepscript</code>. Should be on the form <code>--prepparam "key=value"</code>. For an overview of the most common parameters, see [[#Preparation parameters]]


The value of a parameter for the chosen <code>--prepscript</code>. Should be on the form <code>--prepparam "key=value"</code>.
==== <code>--includesourcedata</code> ====
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 <code>true</code> or <code>false</code>. Default is <code>false</code>.


<code>--includesourcedata</code>
==== <code>--elevationdatatype</code> ====
The elevation data type. Valid values are <code>undefined</code>, <code>terrainmodel</code>, <code>surfacemodel</code> and <code>bathymetry</code>. Default is <code>terrainmodel</code>.


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 <code>true</code> or <code>false</code>. Default is <code>false</code>.
==== <code>--tags</code> ====
Comma separated list of text tags applicable to elevation data only.


<code>--elevationdatatype</code>
==== <code>--epsg</code> ====
EPSG code of the source dataset if this information is not embedded.


The elevation data type. Valid values are 'undefined', 'terrainmodel', 'surfacemodel' and 'bathymetry'. Default is 'surfacemodel'.
== Preparation parameters ==
Preparation parameters (<code>--prepparam</code>) are key/value pairs which affect the result of the map import with the New-Dataset and Update-Dataset commands. The available parameters depend on the type of source data being imported. They are defined in the various map preparation scripts, which can be found at <code>{MariaMapMakerInstallDirectory}\ServiceHoster\AddInRoot\AddIns\Preparation\scripts</code>


<code>--tags</code>
The table below lists some of the most commonly used parameters along with valid values. For a more detailed explanation of these parameters, see [[Importing data]]
 
{| class="wikitable"
Comma separated list of text tags applicable to elevation data only.
|+
!Import type
!Parameter
!Valid values
|-
|vector
|minzoom
|<code>0-18</code>
|-
|vector
|maxzoom
|<code>0-18</code>
|-
|vector
|selectedlayerlist
|Comma-separated list of layers to include
|-
|raster
|srcnodata
|"<code>R G B</code>" values to make transparent in imported data
|-
|raster
|tile_format
|<code>auto</code>, <code>png</code>, <code>png8</code>
|-
|raster
|quality
|<code>10-100</code>
|-
|coverage
|datatype
|<code>16,32</code>
|-
|*coverage/elevation/raster
|proccount
|<code>light</code>, <code>moderate</code>, <code>aggressive</code>, <code>extreme</code>
|-
|*coverage/elevation/raster
|clippingdataset
|Path to vector dataset to clip imported data
|-
|*coverage/elevation/raster
|resampling
|<code>Average</code>,<code>Nearest</code>, <code>Bilinear</code>, <code>Cubic</code>, <code>Lanczos</code>, <code>Gauss</code>, <code>CubicSpline</code>
|}
''*  Available for coverage/elevation imports from version 4.6''


== Exit codes ==
== Exit codes ==
Line 179: Line 207:
|-
|-
|6
|6
|Unknown error
|Missing source data
|-
|7
|Uknown error
|}
|}


Line 188: Line 219:
</syntaxhighlight>Set a released product to "Draft", update a dataset, and set to "Released":<syntaxhighlight lang="pwsh">
</syntaxhighlight>Set a released product to "Draft", update a dataset, and set to "Released":<syntaxhighlight lang="pwsh">
MariaMapMakerCLI.exe Update-Product --path "c:\products\" --productid "9075c2fb-ef9f-4300-9008-83f4ecef0ec5" --setstatus "draft"
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-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 "srcnodata=255 255 252" --includesourcedata "true"
MariaMapMakerCLI.exe Update-Product --path "c:\products\" --productid "9075c2fb-ef9f-4300-9008-83f4ecef0ec5" --setstatus "released" -pmd "displayversion=2023-05"
MariaMapMakerCLI.exe Update-Product --path "c:\products\" --productid "9075c2fb-ef9f-4300-9008-83f4ecef0ec5" --setstatus "released" -pmd "displayversion=2023-05"
</syntaxhighlight>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".<syntaxhighlight lang="pwsh" line="1">
</syntaxhighlight>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".<syntaxhighlight lang="pwsh" line="1">
Line 203: Line 234:
# Set product to draft. This command returns two values:  
# Set product to draft. This command returns two values:  
# the new product path [0] and the product ID [1].
# the new product path [0] and the product ID [1].
[array]$product = . $m3cli Update-Product --setstatus "draft"
[array]$product = . $m3cli Update-Product --path $productpath --setstatus "draft"


# Update each dataset in turn
# Update each dataset in turn
Line 212: Line 243:
         --path $product[0] `
         --path $product[0] `
         --sourcedata $($updates[$signature]) `
         --sourcedata $($updates[$signature]) `
         --prepparam "nodata=255 255 252" `
         --prepparam "srcnodata=255 255 252" `
         --prepparam "tile_format=PNG8" `
         --prepparam "tile_format=PNG8" `
         --datasetmetadata "datadate=2023-11-01" `
         --datasetmetadata "datadate=2023-11-01" `

Latest revision as of 08:50, 26 September 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 to reference the dataset. 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 terrainmodel.

--tags

Comma separated list of text tags applicable to elevation data only.

--epsg

EPSG code of the source dataset if this information is not embedded.

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". For an overview of the most common parameters, see #Preparation parameters

--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 terrainmodel.

--tags

Comma separated list of text tags applicable to elevation data only.

--epsg

EPSG code of the source dataset if this information is not embedded.

Preparation parameters

Preparation parameters (--prepparam) are key/value pairs which affect the result of the map import with the New-Dataset and Update-Dataset commands. The available parameters depend on the type of source data being imported. They are defined in the various map preparation scripts, which can be found at {MariaMapMakerInstallDirectory}\ServiceHoster\AddInRoot\AddIns\Preparation\scripts

The table below lists some of the most commonly used parameters along with valid values. For a more detailed explanation of these parameters, see Importing data

Import type Parameter Valid values
vector minzoom 0-18
vector maxzoom 0-18
vector selectedlayerlist Comma-separated list of layers to include
raster srcnodata "R G B" values to make transparent in imported data
raster tile_format auto, png, png8
raster quality 10-100
coverage datatype 16,32
*coverage/elevation/raster proccount light, moderate, aggressive, extreme
*coverage/elevation/raster clippingdataset Path to vector dataset to clip imported data
*coverage/elevation/raster resampling Average,Nearest, Bilinear, Cubic, Lanczos, Gauss, CubicSpline

* Available for coverage/elevation imports from version 4.6

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 Missing source data
7 Uknown 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 "srcnodata=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 --path $productpath --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 "srcnodata=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"