geowatch.gis.digital_globe module

Helpers for reading data downloaded from digital globe

Notes

The data in the Core3D dataset is public and can be rehosted.

https://spacenet.ai/core3d/

AWS_PROFILE=iarpa aws s3 ls s3://spacenet-dataset/Hosted-Datasets/CORE3D-Public-Data/Satellite-Images/ AWS_PROFILE=iarpa aws s3 ls s3://spacenet-dataset/Hosted-Datasets/CORE3D-Public-Data/Tiled-Examples-for-Urban-3D-Challenge-Comparisons/02_Master/challenge-inputs/

AWS_PROFILE=iarpa aws s3 cp

s3://spacenet-dataset/Hosted-Datasets/CORE3D-Public-Data/Tiled-Examples-for-Urban-3D-Challenge-Comparisons/02_Master/challenge-inputs/RIC_Tile_000_DSM.tif RIC_Tile_000_DSM.tif

AWS_PROFILE=iarpa aws s3 cp

s3://spacenet-dataset/Hosted-Datasets/CORE3D-Public-Data/Tiled-Examples-for-Urban-3D-Challenge-Comparisons/02_Master/challenge-inputs/RIC_Tile_000_DTM.tif RIC_Tile_000_DTM.tif

AWS_PROFILE=iarpa aws s3 cp

s3://spacenet-dataset/Hosted-Datasets/CORE3D-Public-Data/Tiled-Examples-for-Urban-3D-Challenge-Comparisons/02_Master/challenge-inputs/RIC_Tile_000_RGB.tif RIC_Tile_000_RGB.tif

Requirements:

pip install xmltodict pip install pyshp pip install cogeotiff

class geowatch.gis.digital_globe.DigitalGlobeBundle(delivery_metadata_fpath, pointer=None, autobuild=True)[source]

Bases: NiceRepr

Data structure to organize information in digital globe bundles

TODO: need public digital globe demodata for a doctest

Maybe we can grab them from here? https://www.maxar.com/product-samples https://ard.maxar.com/samples#v5/

https://spacenet.ai/core3d/

Requirements:

pip isntall pyshp

parse_delivery_metadata()[source]
classmethod from_pointer(pointer, **kw)[source]
Parameters:

pointer (str) – a path to any file inside a digital globe bundle. We will search for the DeliveryMetadata.xml data.

classmethod coerce(key, **kw)[source]
geowatch.gis.digital_globe.search_path_ancestors(path, fname, stop_fname=None, max_steps=1000)[source]

Search path and all of its containing folders for a file name fname.

Parameters:
  • path (str) – directory to start the search

  • fname (str) – path to search for

  • stop_fname (str) – stop if we find a file with this name.

geowatch.gis.digital_globe.ensure_unicode(text)[source]

Casts bytes into utf8 (mostly for python2 compatibility).

Parameters:

text (str | bytes) – text to ensure is decoded as unicode

Returns:

str

References

Example

>>> import codecs  # NOQA
>>> assert ensure_unicode('my ünicôdé strįng') == 'my ünicôdé strįng'
>>> assert ensure_unicode('text1') == 'text1'
>>> assert ensure_unicode('text1'.encode('utf8')) == 'text1'
>>> assert ensure_unicode('text1'.encode('utf8')) == 'text1'
>>> assert (codecs.BOM_UTF8 + 'text»¿'.encode('utf8')).decode('utf8')