API Docs¶
Documentation for the package’s Python API for usage as a library.
Individual files¶
The main function is:
geoextent.fromFile(input, bbox, time)
- Parameters:
input
: a string value of input file or pathbbox
: a boolean value to extract spatial extent (bounding box)time
: a boolean value to extract temporal extent ( at “day” precision ‘%Y-%m-%d’)
The output of this function is the bbox and/or the tbox for individual files (see: Supported file formats). The resulting coordinate reference system CRS
of the bounding box is the one resulting from the extraction (i.e no transformation to other coordinate reference system).
Examples¶
Extract bounding box from a single file¶
Code:
geoextent.fromFile('muenster_ring_zeit.geojson', True, False)
Output:
Processing muenster_ring_zeit.geojson: 0%| | 0/1 [00:00<?, ?task/s]
Processing muenster_ring_zeit.geojson: 0%| | 0/1 [00:00<?, ?task/s, Spatial extent extracted]
{'format': 'geojson',
'geoextent_handler': 'handleVector',
'bbox': [7.6016807556152335,
51.94881477206191,
7.647256851196289,
51.974624029877454],
'crs': '4326'}
Extracting time interval from a single file¶
Code:
geoextent.fromFile('muenster_ring_zeit.geojson', False, True)
Output:
Processing muenster_ring_zeit.geojson: 0%| | 0/1 [00:00<?, ?task/s]
Processing muenster_ring_zeit.geojson: 0%| | 0/1 [00:00<?, ?task/s, Temporal extent extracted]
{'format': 'geojson',
'geoextent_handler': 'handleVector',
'tbox': ['2018-11-14', '2018-11-14']}
Extracting both bounding box and time interval from a single file¶
Code:
geoextent.fromFile('muenster_ring_zeit.geojson', True, True)
Output:
Processing muenster_ring_zeit.geojson: 0%| | 0/2 [00:00<?, ?task/s]
Processing muenster_ring_zeit.geojson: 0%| | 0/2 [00:00<?, ?task/s, Spatial extent extracted]
Processing muenster_ring_zeit.geojson: 50%|█████ | 1/2 [00:00<00:00, 150.52task/s, Temporal extent extracted]
{'format': 'geojson',
'geoextent_handler': 'handleVector',
'bbox': [7.6016807556152335,
51.94881477206191,
7.647256851196289,
51.974624029877454],
'crs': '4326',
'tbox': ['2018-11-14', '2018-11-14']}
Folders or ZIP file(s)¶
Geoextent also supports queries for multiple files inside folders or ZIP files.
geoextent.fromDirectory(input, bbox, time, details)
- Parameters:
input
: a string value of directory of zipfile pathbbox
: a boolean value to extract spatial extent (bounding box)time
: a boolean value to extract temporal extent ( at “day” precision ‘%Y-%m-%d’)details
: a boolean value to return details (geoextent) of individual files (default False)
The output of this function is the combined bbox or tbox resulting from merging all results of individual files (see: Supported file formats) inside the folder or zipfile. The resulting coordinate reference system CRS
of the combined bbox is always in the EPSG: 4326 system.
Extracting both bounding box and time interval from a folder (with details)¶
Code:
geoextent.fromDirectory('folder_one_file', True, True, True)
Output:
Processing directory: folder_one_file: 0%| | 0/1 [00:00<?, ?item/s]
Processing directory: folder_one_file: 0%| | 0/1 [00:00<?, ?item/s, Processing muenster_ring_zeit.geojson]
Processing muenster_ring_zeit.geojson: 0%| | 0/2 [00:00<?, ?task/s]
[A
Processing muenster_ring_zeit.geojson: 0%| | 0/2 [00:00<?, ?task/s, Spatial extent extracted]
[A
Processing muenster_ring_zeit.geojson: 50%|█████ | 1/2 [00:00<00:00, 112.53task/s, Temporal extent extracted]
[A
[A
Processing directory: folder_one_file: 100%|██████████| 1/1 [00:00<00:00, 44.09item/s, Processing muenster_ring_zeit.geojson]
{'format': 'folder',
'crs': '4326',
'bbox': {'type': 'Polygon',
'coordinates': [[[7.608118057250977, 51.94881477206191],
[7.602796554565429, 51.953258408047034],
[7.6016807556152335, 51.96537036973145],
[7.606401443481445, 51.97361943924433],
[7.62125015258789, 51.974624029877454],
[7.636871337890624, 51.97240332571046],
[7.645368576049805, 51.96817310852836],
[7.645540237426757, 51.96780294552556],
[7.6471710205078125, 51.96330786509095],
[7.647256851196289, 51.95807185013927],
[7.643308639526367, 51.953258408047034],
[7.608118057250977, 51.94881477206191]]]},
'convex_hull': True,
'tbox': ['2018-11-14', '2018-11-14']}
Zenodo repositories¶
Geoextent also supports queries for Zenodo repositories. Geoextent creates a temporal copy of the repository and extracts the temporal or geographical extent. Geoextent only allows to query Open Zenodo repositories.
geoextent.fromRemote(repository_identifier, bbox, time, details)
- Parameters:
repository_identifier
: a string value with a Zenodo link (e.g., https://zenodo.org/record/3528062) or DOI (e.g., https://doi.org/10.5281/zenodo.3528062)bbox
: a boolean value to extract spatial extent (bounding box)time
: a boolean value to extract temporal extent (at “day” precision ‘%Y-%m-%d’)details
: a boolean value to return details (geoextent) of individual files (default False)
The output of this function is the combined bbox or tbox resulting from merging all results of individual files (see: Supported file formats) inside the repository. The resulting coordinate reference system CRS
of the combined bbox is always in the EPSG: 4326 system.
Code:
geoextent.fromRemote('https://zenodo.org/record/820562', True, True, False)
Output:
Processing Zenodo metadata for 820562: 0%| | 0/6 [00:00<?, ?file/s]
Processing Zenodo metadata for 820562: 0%| | 0/6 [00:00<?, ?file/s, Processing 20160100_Hpakan_20160322_POST.png (2,390,221 bytes)]
Processing Zenodo metadata for 820562: 17%|█▋ | 1/6 [00:00<00:00, 1390.68file/s, Processing 20160100_Hpakan_20151123_PRE.tif (4,517,956 bytes)]
Processing Zenodo metadata for 820562: 33%|███▎ | 2/6 [00:00<00:00, 1741.82file/s, Processing 20160100_Hpakan_20151123_PRE.pngw (81 bytes)]
Processing Zenodo metadata for 820562: 50%|█████ | 3/6 [00:00<00:00, 1829.18file/s, Processing 20160100_Hpakan_20160322_POST.tif (4,517,956 bytes)]
Processing Zenodo metadata for 820562: 67%|██████▋ | 4/6 [00:00<00:00, 1718.98file/s, Processing 20160100_Hpakan_20160322_POST.pngw (81 bytes)]
Processing Zenodo metadata for 820562: 83%|████████▎ | 5/6 [00:00<00:00, 1807.27file/s, Processing 20160100_Hpakan_20151123_PRE.png (2,631,570 bytes)]
Downloading files: 0%| | 0.00/14.1M [00:00<?, ?B/s]
Downloading files: 0%| | 81.0/14.1M [00:00<30:46:46, 127B/s]
Downloading files: 0%| | 81.0/14.1M [00:00<30:46:46, 127B/s, files=1/6]
Downloading files: 0%| | 162/14.1M [00:00<20:25:59, 191B/s, files=1/6]
Downloading files: 0%| | 162/14.1M [00:00<20:25:59, 191B/s, files=2/6]
Downloading files: 17%|█▋ | 2.39M/14.1M [00:00<16:57:32, 191B/s, files=3/6]
Downloading files: 49%|████▉ | 6.91M/14.1M [00:01<00:00, 7.46MB/s, files=3/6]
Downloading files: 49%|████▉ | 6.91M/14.1M [00:01<00:00, 7.46MB/s, files=4/6]
Downloading files: 81%|████████▏ | 11.4M/14.1M [00:01<00:00, 12.3MB/s, files=4/6]
Downloading files: 81%|████████▏ | 11.4M/14.1M [00:01<00:00, 12.3MB/s, files=5/6]
Downloading files: 100%|██████████| 14.1M/14.1M [00:02<00:00, 7.98MB/s, files=5/6]
Downloading files: 100%|██████████| 14.1M/14.1M [00:02<00:00, 7.98MB/s, files=6/6]
Downloading files: 100%|██████████| 14.1M/14.1M [00:02<00:00, 6.81MB/s, files=6/6]
Processing directory: tmpj1tj2b2d: 0%| | 0/6 [00:00<?, ?item/s]
Processing directory: tmpj1tj2b2d: 0%| | 0/6 [00:00<?, ?item/s, Processing 20160100_Hpakan_20160322_POST.pngw]
Processing directory: tmpj1tj2b2d: 17%|█▋ | 1/6 [00:00<00:00, 6.61item/s, Processing 20160100_Hpakan_20160322_POST.pngw]
Processing directory: tmpj1tj2b2d: 17%|█▋ | 1/6 [00:00<00:00, 6.61item/s, Processing 20160100_Hpakan_20160322_POST.png]
Processing 20160100_Hpakan_20160322_POST.png: 0%| | 0/2 [00:00<?, ?task/s]
[A
Error for /tmp/tmpj1tj2b2d/20160100_Hpakan_20160322_POST.png extracting bbox: OGR Error: Corrupt data
Processing 20160100_Hpakan_20160322_POST.png: 0%| | 0/2 [00:00<?, ?task/s, Spatial extent extracted]
[A
Processing 20160100_Hpakan_20160322_POST.png: 50%|█████ | 1/2 [00:00<00:00, 297.81task/s, Temporal extent extracted]
[A
[A
Processing directory: tmpj1tj2b2d: 33%|███▎ | 2/6 [00:00<00:00, 6.61item/s, Processing 20160100_Hpakan_20151123_PRE.pngw]
Processing directory: tmpj1tj2b2d: 50%|█████ | 3/6 [00:00<00:00, 6.61item/s, Processing 20160100_Hpakan_20151123_PRE.png]
Processing 20160100_Hpakan_20151123_PRE.png: 0%| | 0/2 [00:00<?, ?task/s]
[A
Error for /tmp/tmpj1tj2b2d/20160100_Hpakan_20151123_PRE.png extracting bbox: OGR Error: Corrupt data
Processing 20160100_Hpakan_20151123_PRE.png: 0%| | 0/2 [00:00<?, ?task/s, Spatial extent extracted]
[A
Processing 20160100_Hpakan_20151123_PRE.png: 50%|█████ | 1/2 [00:00<00:00, 234.66task/s, Temporal extent extracted]
[A
[A
Processing directory: tmpj1tj2b2d: 67%|██████▋ | 4/6 [00:00<00:00, 6.61item/s, Processing 20160100_Hpakan_20151123_PRE.tif]
Processing 20160100_Hpakan_20151123_PRE.tif: 0%| | 0/2 [00:00<?, ?task/s]
[A
Processing 20160100_Hpakan_20151123_PRE.tif: 0%| | 0/2 [00:00<?, ?task/s, Spatial extent extracted]
[A
Processing 20160100_Hpakan_20151123_PRE.tif: 50%|█████ | 1/2 [00:00<00:00, 80.72task/s, Temporal extent extracted]
[A
[A
Processing directory: tmpj1tj2b2d: 83%|████████▎ | 5/6 [00:00<00:00, 22.42item/s, Processing 20160100_Hpakan_20151123_PRE.tif]
Processing directory: tmpj1tj2b2d: 83%|████████▎ | 5/6 [00:00<00:00, 22.42item/s, Processing 20160100_Hpakan_20160322_POST.tif]
Processing 20160100_Hpakan_20160322_POST.tif: 0%| | 0/2 [00:00<?, ?task/s]
[A
Processing 20160100_Hpakan_20160322_POST.tif: 0%| | 0/2 [00:00<?, ?task/s, Spatial extent extracted]
[A
Processing 20160100_Hpakan_20160322_POST.tif: 50%|█████ | 1/2 [00:00<00:00, 87.87task/s, Temporal extent extracted]
[A
[A
Processing directory: tmpj1tj2b2d: 100%|██████████| 6/6 [00:00<00:00, 20.80item/s, Processing 20160100_Hpakan_20160322_POST.tif]
The folder /tmp/tmpj1tj2b2d has no identifiable time extent
{'format': 'remote',
'crs': '4326',
'bbox': [96.21146318274846,
25.56156568254296,
96.35495081696702,
25.6297452149091]}