Skip to content

Commit a30a7f1

Browse files
committed
Rework the library to preserve local projects until export
The library now has two core functions: to download numpy tiles or to export GeoTIFFs that preserve the CRS, leaving reprojection to other tools. The CLI now uses rich progress bars and is cleaner as well, and includes Natural World country support as a convenient alias. We also include a WIP umap parametric resampler for really nice visualisation.
1 parent 8704779 commit a30a7f1

28 files changed

+7728
-5043
lines changed

README.md

Lines changed: 519 additions & 212 deletions
Large diffs are not rendered by default.

docs/architecture.rst

Lines changed: 482 additions & 0 deletions
Large diffs are not rendered by default.

docs/cli_reference.rst

Lines changed: 488 additions & 0 deletions
Large diffs are not rendered by default.

docs/geotessera.rst

Lines changed: 139 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,180 @@
11
geotessera package
22
==================
33

4-
Submodules
5-
----------
4+
The GeoTessera package provides streamlined access to Tessera geospatial embeddings through a clean Python API and comprehensive CLI.
65

7-
geotessera.core module
8-
----------------------
6+
Package Overview
7+
----------------
98

10-
.. automodule:: geotessera.core
9+
.. automodule:: geotessera
1110
:members:
1211
:show-inheritance:
1312
:undoc-members:
1413

15-
geotessera.cli module
16-
---------------------
14+
Core Modules
15+
------------
1716

18-
.. automodule:: geotessera.cli
19-
:members:
20-
:show-inheritance:
21-
:undoc-members:
17+
geotessera.core module
18+
~~~~~~~~~~~~~~~~~~~~~~
2219

23-
geotessera.io module
24-
--------------------
20+
The main interface for accessing Tessera embeddings. Contains the primary GeoTessera class with methods for fetching embeddings and exporting to various formats.
2521

26-
.. automodule:: geotessera.io
22+
.. automodule:: geotessera.core
2723
:members:
2824
:show-inheritance:
2925
:undoc-members:
3026

31-
geotessera.spatial module
32-
-------------------------
27+
geotessera.registry module
28+
~~~~~~~~~~~~~~~~~~~~~~~~~~
29+
30+
Registry management for efficient data discovery and access. Handles the block-based registry system, lazy loading, and metadata management.
3331

34-
.. automodule:: geotessera.spatial
32+
.. automodule:: geotessera.registry
3533
:members:
3634
:show-inheritance:
3735
:undoc-members:
3836

39-
geotessera.parallel module
40-
--------------------------
37+
geotessera.visualization module
38+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4139

42-
.. automodule:: geotessera.parallel
40+
Visualization utilities for creating maps, web tiles, and interactive visualizations from GeoTIFF files.
41+
42+
.. automodule:: geotessera.visualization
4343
:members:
4444
:show-inheritance:
4545
:undoc-members:
4646

47-
geotessera.export module
48-
------------------------
47+
Command Line Interface
48+
----------------------
4949

50-
.. automodule:: geotessera.export
51-
:members:
52-
:show-inheritance:
53-
:undoc-members:
50+
geotessera.cli module
51+
~~~~~~~~~~~~~~~~~~~~~
5452

55-
geotessera.registry_cli module
56-
------------------------------
53+
Comprehensive command-line interface providing download, visualization, and serving capabilities.
5754

58-
.. automodule:: geotessera.registry_cli
55+
.. automodule:: geotessera.cli
5956
:members:
6057
:show-inheritance:
6158
:undoc-members:
6259

63-
geotessera.registry_utils module
64-
--------------------------------
60+
Key Classes and Functions
61+
-------------------------
62+
63+
GeoTessera Class
64+
~~~~~~~~~~~~~~~~
6565

66-
.. automodule:: geotessera.registry_utils
66+
The main interface for accessing Tessera embeddings:
67+
68+
.. autoclass:: geotessera.GeoTessera
6769
:members:
6870
:show-inheritance:
69-
:undoc-members:
7071

72+
Key methods:
7173

72-
Module contents
73-
---------------
74+
* :meth:`~geotessera.GeoTessera.fetch_embedding` - Fetch a single embedding tile
75+
* :meth:`~geotessera.GeoTessera.fetch_embeddings` - Fetch multiple tiles in a bounding box
76+
* :meth:`~geotessera.GeoTessera.export_embedding_geotiffs` - Export embeddings as GeoTIFF files
7477

75-
.. automodule:: geotessera
78+
Registry Class
79+
~~~~~~~~~~~~~~
80+
81+
Manages data discovery and access:
82+
83+
.. autoclass:: geotessera.registry.Registry
7684
:members:
7785
:show-inheritance:
78-
:undoc-members:
86+
87+
Key methods:
88+
89+
* :meth:`~geotessera.registry.Registry.get_available_embeddings` - List all available tiles
90+
* :meth:`~geotessera.registry.Registry.ensure_all_blocks_loaded` - Load complete registry for coverage maps
91+
* :meth:`~geotessera.registry.Registry.load_blocks_for_region` - Load registry for specific region
92+
93+
Visualization Functions
94+
~~~~~~~~~~~~~~~~~~~~~~~
95+
96+
Main visualization functions:
97+
98+
.. autofunction:: geotessera.visualization.visualize_global_coverage
99+
100+
.. autofunction:: geotessera.visualization.create_rgb_mosaic_from_geotiffs
101+
102+
.. autofunction:: geotessera.visualization.geotiff_to_web_tiles
103+
104+
.. autofunction:: geotessera.visualization.create_coverage_summary_map
105+
106+
Utility Functions
107+
~~~~~~~~~~~~~~~~~
108+
109+
Registry utility functions:
110+
111+
.. autofunction:: geotessera.registry.get_tile_bounds
112+
113+
.. autofunction:: geotessera.registry.world_to_tile_coords
114+
115+
.. autofunction:: geotessera.registry.get_block_coordinates
116+
117+
Examples
118+
--------
119+
120+
Basic Usage
121+
~~~~~~~~~~~
122+
123+
Initialize and fetch embeddings::
124+
125+
from geotessera import GeoTessera
126+
127+
# Initialize client
128+
gt = GeoTessera()
129+
130+
# Fetch single tile
131+
embedding = gt.fetch_embedding(lat=52.05, lon=0.15, year=2024)
132+
133+
# Fetch region
134+
bbox = (-0.2, 51.4, 0.1, 51.6)
135+
embeddings = gt.fetch_embeddings(bbox, year=2024)
136+
137+
Export to GeoTIFF
138+
~~~~~~~~~~~~~~~~~
139+
140+
Export embeddings for GIS use::
141+
142+
# Export all bands
143+
files = gt.export_embedding_geotiffs(
144+
bbox=bbox,
145+
output_dir="./output",
146+
year=2024
147+
)
148+
149+
# Export specific bands
150+
rgb_files = gt.export_embedding_geotiffs(
151+
bbox=bbox,
152+
output_dir="./rgb_output",
153+
year=2024,
154+
bands=[0, 1, 2]
155+
)
156+
157+
Create Visualizations
158+
~~~~~~~~~~~~~~~~~~~~~
159+
160+
Generate visualizations::
161+
162+
from geotessera.visualization import (
163+
create_rgb_mosaic_from_geotiffs,
164+
visualize_global_coverage
165+
)
166+
167+
# Create RGB mosaic
168+
create_rgb_mosaic_from_geotiffs(
169+
geotiff_paths=rgb_files,
170+
output_path="mosaic.tif",
171+
bands=(0, 1, 2),
172+
normalize=True
173+
)
174+
175+
# Create coverage map
176+
visualize_global_coverage(
177+
tessera_client=gt,
178+
output_path="coverage.png",
179+
year=2024
180+
)

0 commit comments

Comments
 (0)