KMZ product creation elements (sarpy.visualization.kmz_product_creation)

This module provides tools for creating kmz products for a SICD type element.

Note

Creation of ground overlays (i.e. image overlay) requires the optional Pillow dependency for image manipulation.

Examples

Create a kmz overview for the contents of a sicd type reader.

import os
from sarpy.io.complex.converter import open_complex
from sarpy.visualization.kmz_product_creation import create_kmz_view

test_root = '<root directory>'
reader = open_complex(os.path.join(test_root, '<file name>>'))
create_kmz_view(reader, test_root,
                file_stem='View-<something descriptive>',
                pixel_limit=2048,
                inc_collection_wedge=True)
sarpy.visualization.kmz_product_creation.prepare_kmz_file(file_name, **args)

Prepare a kmz document and archive for exporting.

Parameters:
  • file_name (str) –

  • args – Passed through to the Document constructor.

Return type:

Document

sarpy.visualization.kmz_product_creation.add_sicd_geometry_elements(sicd, kmz_document, folder, inc_image_corners=True, inc_valid_data=False, inc_scp=False, inc_collection_wedge=True)

Write the geometry elements of a SICD.

Parameters:
  • sicd (SICDType) –

  • kmz_document (Document) –

  • folder (minidom.Element) –

  • inc_image_corners (bool) – Include the image corners, if possible?

  • inc_valid_data (bool) – Include the valid image area, if possible?

  • inc_scp (bool) – Include the scp?

  • inc_collection_wedge (bool) – Include the aperture location and collection wedge?

Return type:

None

sarpy.visualization.kmz_product_creation.add_sicd_from_ortho_helper(kmz_document, ortho_helper, inc_image_corners=False, inc_valid_data=False, inc_scp=False, inc_collection_wedge=False, block_size=10, remap_function=None)

Adds for a SICD to the provided open kmz from an ortho-rectification helper.

Parameters:
  • kmz_document (Document) –

  • ortho_helper (OrthorectificationHelper) –

  • inc_image_corners (bool) – Include the image corners, if possible?

  • inc_valid_data (bool) – Include the valid image area, if possible?

  • inc_scp (bool) – Include the scp?

  • inc_collection_wedge (bool) – Include the aperture location and collection wedge?

  • block_size (None|int|float) – The block size for the iterator

  • remap_function (None|RemapFunction) – The remap function to apply, or a suitable default will be chosen.

sarpy.visualization.kmz_product_creation.add_sicd_to_kmz(kmz_document, reader, index=0, pixel_limit=2048, inc_image_corners=False, inc_valid_data=False, inc_scp=False, inc_collection_wedge=False, block_size=10, remap_function=None)

Adds elements for this SICD to the provided open kmz.

Parameters:
  • kmz_document (Document) – The kmz document, which must be open and have an associated archive.

  • reader (SICDTypeReader) – The reader instance, must be of sicd type:

  • index (int) – The index to use.

  • pixel_limit (None|int) – The limit in pixel size to use for the constructed ground overlay.

  • inc_image_corners (bool) – Include the image corners, if possible?

  • inc_valid_data (bool) – Include the valid image area, if possible?

  • inc_scp (bool) – Include the scp?

  • inc_collection_wedge (bool) – Include the aperture location and collection wedge?

  • block_size (None|int|float) – The block size for the iterator

  • remap_function (None|RemapFunction) – The remap function to apply, or a suitable default will be chosen.

Return type:

None

sarpy.visualization.kmz_product_creation.create_kmz_view(reader, output_directory, file_stem='view', pixel_limit=2048, inc_image_corners=False, inc_valid_data=False, inc_scp=True, inc_collection_wedge=False, block_size=10, remap_function=None)

Create a kmz view for the reader contents. This will create one file per band/polarization present in the reader.

Parameters:
  • reader (SICDTypeReader) –

  • output_directory (str) –

  • file_stem (str) –

  • pixel_limit (None|int) –

  • inc_image_corners (bool) – Include the image corners, if possible?

  • inc_valid_data (bool) – Include the valid image area, if possible?

  • inc_scp (bool) – Include the scp?

  • inc_collection_wedge (bool) – Include the aperture location and collection wedge?

  • block_size (None|int|float) – The block size for the iterator

  • remap_function (None|RemapFunction) – The remap function to apply, or a suitable default will be chosen.

Return type:

None

Examples

import logging
logger = logging.getLogger('sarpy')
logger.setLevel('INFO')

import os
from sarpy.io.complex.converter import open_complex
from sarpy.visualization.kmz_product_creation import create_kmz_view

test_root = '<root directory>'
reader = open_complex(os.path.join(test_root, '<file name>>'))
create_kmz_view(reader, test_root,
                file_stem='View-<something descriptive>',
                pixel_limit=2048,
                inc_collection_wedge=True)