max-ard
CLI¶
Grid Tools¶
Maxar ARD products are divided along a global discrete grid of 5km x 5km squares, organized by quadkeys and split into UTM zones.
The Python package maxar-canvas-grid
offers functionality for working with ARD Grid cells and is covered in the SDK section. max-ard
uses this package and installs it as a requirement
The CLI provides these tools for working with grid cells:
max-ard cell describe
¶
Usage: max-ard cell describe CELL_ID [--format FORMAT]
or max-ard cell describe QUADKEY ZONE [--format FORMAT]
Describes a zoom 12 grid cell as used by ARD tiles. Optionally, you can generate the cell as GeoJSON
Describe a grid cell with a full ID¶
A full cell ID starts has the following format:
z<two digit zone ID>-<quadkey>
This will return information about the cell:
% max-ard cell describe Z10-120002021202
Cell 120002021202 in zone 10
UTM bounds:
Lower left corner: 540000.0, 4690000.0
Upper right corner: 545000.0, 4695000.0
Geographic bounds:
Lower left corner: -122.5142545446021, 42.36096845455453
Upper right corner: -122.45314825564054, 42.40627045167697
Cell size: 0.0611062889615539m
Describe a grid cell with a quadkey and a zone¶
You can also run the command with just the quadkey followed by the zone number:
% max-ard cell describe 120002021202 10
Cell 120002021202 in zone 10
UTM bounds:
Lower left corner: 540000.0, 4690000.0
Upper right corner: 545000.0, 4695000.0
Geographic bounds:
Lower left corner: -122.5142545446021, 42.36096845455453
Upper right corner: -122.45314825564054, 42.40627045167697
Cell size: 0.0611062889615539m
Generate a GeoJSON representation of a cell¶
Use the --format geojson
option to return GeoJSON:
% max-ard cell describe Z10-120002021202 --format geojson
{"type": "Feature", "properties": {"id": "Z10-120002021202"}, "geometry": {"type": "Polygon", "coordinates": [[[-122.45353889438631, 42.36096845455453], [-122.45314825564054, 42.405996718509776], [-122.51390730412858, 42.40627045167697], [-122.5142545446021, 42.36124175888317], [-122.45353889438631, 42.36096845455453]]]}}
Generate a GeoJSON file of a cell¶
Use output redirection with > <filename>
and the previous example:
% max-ard cell describe Z08-03201333302 --format geojson > my_file.geojson
max-ard cell covers
¶
Usage: max-ard cell covers GEOMETRY [--format FORMAT]
maxar-canvas-grid
has a function called covers
that calculates the grid cells covered by a given geometry.
The CLI offers a similar tool:
Find cell IDs covering a geometry¶
This tool can take WKT or GeoJSON strings as input geometries, and will output a list of all of the cell IDs that intersect the geometry.
% max-ard cell covers 'POINT( -122.5 42.4)'
Z10-120002021202
Generate GeoJSON of cells covering a geometry¶
The --format geojson
option works the same as with max-ard cell describe
and can generate GeoJSON of the cell(s) or send it to a file.
% max-ard cell covers 'POINT( -122.5 42.4)' --format geojson
{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"id": "Z10-120002021202"}, "geometry": {"type": "Polygon", "coordinates": [[[-122.45353889438631, 42.36096845455453], [-122.45314825564054, 42.405996718509776], [-122.51390730412858, 42.40627045167697], [-122.5142545446021, 42.36124175888317], [-122.45353889438631, 42.36096845455453]]]}}]}