pylas/vlrs/geotiff.py
def parse_geo_tiff(
    key_dir_vlr: GeoKeyDirectoryVlr,
    double_vlr: GeoDoubleParamsVlr,
    ascii_vlr: GeoAsciiParamsVlr,
) -> List[GeoTiffKey]:
    """ Parses the GeoTiff VLRs information into nicer structs
    """
    geotiff_keys = []

    for k in key_dir_vlr.geo_keys:
        if k.tiff_tag_location == 0:
            value = k.value_offset
        elif k.tiff_tag_location == 34736:
            value = double_vlr.doubles[k.value_offset]
        elif k.tiff_tag_location == 34737:
            try:
                value = ascii_vlr.strings[k.value_offset][k.count :]
            except IndexError:
                # Maybe I'm just misunderstanding the specification :thinking:
                value = ascii_vlr.strings[0][k.value_offset : k.value_offset + k.count]
        else:
            logger.warning(
                "GeoTiffKey with unknown tiff tag location ({})".format(
                    k.tiff_tag_location
                )
            )
            continue

        geotiff_keys.append(GeoTiffKey(k.id, value))
    return geotiff_keys
def parse_geo_tiff(
    key_dir_vlr: GeoKeyDirectoryVlr,
    double_vlr: GeoDoubleParamsVlr,
    ascii_vlr: GeoAsciiParamsVlr,
) -> List[GeoTiffKey]:
    geotiff_keys = []

    for k in key_dir_vlr.geo_keys:
        if k.tiff_tag_location == 0:
            value = k.value_offset
        elif k.tiff_tag_location == 34736:
            value = double_vlr.doubles[k.value_offset]
        elif k.tiff_tag_location == 34737:
            try:
                value = ascii_vlr.strings[k.value_offset][k.count :]
            except IndexError:
                # Maybe I'm just misunderstanding the specification :thinking:
                value = ascii_vlr.strings[0][k.value_offset : k.value_offset + k.count]
        else:
            logger.warning(
                "GeoTiffKey with unknown tiff tag location ({})".format(
                    k.tiff_tag_location
                )
            )
            continue

        geotiff_keys.append(GeoTiffKey(k.id, value))
    return geotiff_keys
def parse_geo_tiff ( key_dir_vlr : GeoKeyDirectoryVlr , double_vlr : GeoDoubleParamsVlr , ascii_vlr : GeoAsciiParamsVlr , ) -> List [ GeoTiffKey ] : geotiff_keys = [ ] for k in key_dir_vlr . geo_keys : if k . tiff_tag_location == 0 : value = k . value_offset elif k . tiff_tag_location == 34736 : value = double_vlr . doubles [ k . value_offset ] elif k . tiff_tag_location == 34737 : try : value = ascii_vlr . strings [ k . value_offset ] [ k . count : ] except IndexError : # Maybe I'm just misunderstanding the specification :thinking: value = ascii_vlr . strings [ 0 ] [ k . value_offset : k . value_offset + k . count ] else : logger . warning ( "GeoTiffKey with unknown tiff tag location ({})" . format ( k . tiff_tag_location ) ) continue geotiff_keys . append ( GeoTiffKey ( k . id , value ) ) return geotiff_keys
Parses the GeoTiff VLRs information into nicer structs
Parses the GeoTiff VLRs information into nicer structs