mapchete 0.31__tar.gz → 0.32__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- home/ungarj/virtualenvs/p3/bin/mapchete +12 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/__init__.py +1 -1
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/__init__.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/_core.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/_processing.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/_timer.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/_validate.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/config.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/errors.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/index.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/log.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/tile.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/validate.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/_validate.py +212 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/__pycache__/__init__.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/__pycache__/main.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/__pycache__/utils.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/default/__pycache__/__init__.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/default/__pycache__/convert.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/default/__pycache__/create.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/default/__pycache__/execute.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/default/__pycache__/formats.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/default/__pycache__/index.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/default/__pycache__/processes.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/default/__pycache__/serve.cpython-35.pyc +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/default/convert.py +26 -1
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/default/execute.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/default/serve.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/main.py +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/commons/__pycache__/__init__.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/commons/__pycache__/clip.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/commons/__pycache__/contours.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/commons/__pycache__/hillshade.cpython-35.pyc +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/commons/contours.py +13 -7
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/commons/hillshade.py +17 -6
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/config.py +73 -59
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/__pycache__/__init__.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/__pycache__/base.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/__pycache__/drivers.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/default/__pycache__/__init__.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/default/__pycache__/geojson.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/default/__pycache__/gtiff.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/default/__pycache__/mapchete_input.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/default/__pycache__/png.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/default/__pycache__/png_hillshade.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/default/__pycache__/raster_file.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/default/__pycache__/tile_directory.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/formats/default/__pycache__/vector_file.cpython-35.pyc +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/default/gtiff.py +106 -28
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/io/__pycache__/__init__.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/io/__pycache__/_geometry_operations.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/io/__pycache__/_json.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/io/__pycache__/_misc.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/io/__pycache__/_path.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/io/__pycache__/raster.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/io/__pycache__/vector.cpython-35.pyc +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/io/raster.py +27 -3
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/processes/__pycache__/__init__.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/processes/__pycache__/contours.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/processes/__pycache__/convert.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/processes/__pycache__/hillshade.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/processes/contours.py +116 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/processes/convert.py +6 -2
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/processes/examples/__pycache__/__init__.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/processes/examples/__pycache__/example_process.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/processes/hillshade.py +104 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/static/__pycache__/__init__.cpython-35.pyc +0 -0
- home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/static/__pycache__/process_template.cpython-35.pyc +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete-0.32-py3.5.egg-info}/PKG-INFO +7 -7
- {mapchete-0.31/mapchete.egg-info → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete-0.32-py3.5.egg-info}/SOURCES.txt +2 -0
- {mapchete-0.31/mapchete.egg-info → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete-0.32-py3.5.egg-info}/entry_points.txt +2 -0
- {mapchete-0.31/mapchete.egg-info → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete-0.32-py3.5.egg-info}/requires.txt +1 -1
- mapchete-0.31/README.rst +0 -198
- mapchete-0.31/mapchete.egg-info/PKG-INFO +0 -219
- mapchete-0.31/setup.cfg +0 -10
- mapchete-0.31/setup.py +0 -88
- mapchete-0.31/test/test_cli.py +0 -822
- mapchete-0.31/test/test_commons.py +0 -97
- mapchete-0.31/test/test_config.py +0 -260
- mapchete-0.31/test/test_deprecated.py +0 -40
- mapchete-0.31/test/test_errors.py +0 -309
- mapchete-0.31/test/test_formats.py +0 -160
- mapchete-0.31/test/test_formats_geojson.py +0 -121
- mapchete-0.31/test/test_formats_geotiff.py +0 -315
- mapchete-0.31/test/test_formats_png.py +0 -107
- mapchete-0.31/test/test_formats_png_hillshade.py +0 -126
- mapchete-0.31/test/test_formats_tiledir_input.py +0 -189
- mapchete-0.31/test/test_index.py +0 -193
- mapchete-0.31/test/test_io.py +0 -873
- mapchete-0.31/test/test_log.py +0 -17
- mapchete-0.31/test/test_mapchete.py +0 -569
- mapchete-0.31/test/test_processes.py +0 -87
- mapchete-0.31/test/test_timer.py +0 -26
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/_core.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/_processing.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/_timer.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/__init__.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/default/__init__.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/default/create.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/default/formats.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/default/index.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/default/processes.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/utils.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/commons/__init__.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/commons/clip.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/errors.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/__init__.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/base.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/default/__init__.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/default/geojson.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/default/mapchete_input.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/default/png.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/default/png_hillshade.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/default/raster_file.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/default/tile_directory.py +2 -2
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/default/vector_file.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/formats/drivers.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/index.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/io/__init__.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/io/_geometry_operations.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/io/_json.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/io/_misc.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/io/_path.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/io/vector.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/log.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/processes/__init__.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/processes/examples/__init__.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/processes/examples/example_process.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/static/__init__.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/static/index.html +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/static/mapchete_template.mapchete +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/static/process_template.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/tile.py +0 -0
- {mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/validate.py +0 -0
- {mapchete-0.31/mapchete.egg-info → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete-0.32-py3.5.egg-info}/dependency_links.txt +0 -0
- {mapchete-0.31/mapchete.egg-info → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete-0.32-py3.5.egg-info}/top_level.txt +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/home/ungarj/virtualenvs/p3/bin/python
|
|
2
|
+
# EASY-INSTALL-ENTRY-SCRIPT: 'mapchete==0.32','console_scripts','mapchete'
|
|
3
|
+
__requires__ = 'mapchete==0.32'
|
|
4
|
+
import re
|
|
5
|
+
import sys
|
|
6
|
+
from pkg_resources import load_entry_point
|
|
7
|
+
|
|
8
|
+
if __name__ == '__main__':
|
|
9
|
+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
|
10
|
+
sys.exit(
|
|
11
|
+
load_entry_point('mapchete==0.32', 'console_scripts', 'mapchete')()
|
|
12
|
+
)
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/__init__.cpython-35.pyc
ADDED
|
Binary file
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/_core.cpython-35.pyc
ADDED
|
Binary file
|
|
Binary file
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/_timer.cpython-35.pyc
ADDED
|
Binary file
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/_validate.cpython-35.pyc
ADDED
|
Binary file
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/config.cpython-35.pyc
ADDED
|
Binary file
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/errors.cpython-35.pyc
ADDED
|
Binary file
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/index.cpython-35.pyc
ADDED
|
Binary file
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/log.cpython-35.pyc
ADDED
|
Binary file
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/tile.cpython-35.pyc
ADDED
|
Binary file
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/__pycache__/validate.cpython-35.pyc
ADDED
|
Binary file
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
from rasterio.crs import CRS
|
|
2
|
+
from tilematrix._funcs import Bounds
|
|
3
|
+
import warnings
|
|
4
|
+
|
|
5
|
+
from mapchete.tile import BufferedTile, BufferedTilePyramid
|
|
6
|
+
|
|
7
|
+
########################
|
|
8
|
+
# validator functionrs #
|
|
9
|
+
########################
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def validate_zooms(zooms, expand=True):
|
|
13
|
+
"""
|
|
14
|
+
Return a list of zoom levels.
|
|
15
|
+
|
|
16
|
+
Following inputs are converted:
|
|
17
|
+
- int --> [int]
|
|
18
|
+
- dict{min, max} --> [min ... max + 1]
|
|
19
|
+
- [int] --> [int]
|
|
20
|
+
- [int, int] --> [smaller int, bigger int + 1]
|
|
21
|
+
|
|
22
|
+
Parameters
|
|
23
|
+
----------
|
|
24
|
+
zoom : dict, int or list
|
|
25
|
+
|
|
26
|
+
Returns
|
|
27
|
+
-------
|
|
28
|
+
List of zoom levels.
|
|
29
|
+
"""
|
|
30
|
+
if isinstance(zooms, dict):
|
|
31
|
+
if any([a not in zooms for a in ["min", "max"]]):
|
|
32
|
+
raise TypeError("min and max zoom required: %s" % str(zooms))
|
|
33
|
+
zmin = validate_zoom(zooms["min"])
|
|
34
|
+
zmax = validate_zoom(zooms["max"])
|
|
35
|
+
if zmin > zmax:
|
|
36
|
+
raise TypeError("max zoom must not be smaller than min zoom: %s" % str(zooms))
|
|
37
|
+
return list(range(zmin, zmax + 1)) if expand else zooms
|
|
38
|
+
elif isinstance(zooms, list):
|
|
39
|
+
if len(zooms) == 1:
|
|
40
|
+
return zooms
|
|
41
|
+
elif len(zooms) == 2:
|
|
42
|
+
zmin, zmax = sorted([validate_zoom(z) for z in zooms])
|
|
43
|
+
return list(range(zmin, zmax + 1)) if expand else zooms
|
|
44
|
+
else:
|
|
45
|
+
return zooms
|
|
46
|
+
else:
|
|
47
|
+
return [validate_zoom(zooms)] if expand else zooms
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def validate_zoom(zoom):
|
|
51
|
+
"""
|
|
52
|
+
Assert zoom value is positive integer.
|
|
53
|
+
|
|
54
|
+
Returns
|
|
55
|
+
-------
|
|
56
|
+
zoom
|
|
57
|
+
|
|
58
|
+
Raises
|
|
59
|
+
------
|
|
60
|
+
TypeError if type is invalid.
|
|
61
|
+
"""
|
|
62
|
+
if any([not isinstance(zoom, int), zoom < 0]):
|
|
63
|
+
raise TypeError("zoom must be a positive integer: %s" % zoom)
|
|
64
|
+
return zoom
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def validate_bounds(bounds):
|
|
68
|
+
"""
|
|
69
|
+
Bounds must be a list or tuple with exactly four elements.
|
|
70
|
+
|
|
71
|
+
Parameters
|
|
72
|
+
----------
|
|
73
|
+
bounds : list or tuple
|
|
74
|
+
|
|
75
|
+
Returns
|
|
76
|
+
-------
|
|
77
|
+
Bounds
|
|
78
|
+
|
|
79
|
+
Raises
|
|
80
|
+
------
|
|
81
|
+
TypeError if type is invalid.
|
|
82
|
+
"""
|
|
83
|
+
if not isinstance(bounds, (tuple, list)):
|
|
84
|
+
raise TypeError("bounds must be either a tuple or a list: %s" % str(bounds))
|
|
85
|
+
if len(bounds) != 4:
|
|
86
|
+
raise ValueError("bounds has to have exactly four values: %s" % str(bounds))
|
|
87
|
+
return Bounds(*bounds)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def validate_values(config, values):
|
|
91
|
+
"""
|
|
92
|
+
Validate whether value is found in config and has the right type.
|
|
93
|
+
|
|
94
|
+
Parameters
|
|
95
|
+
----------
|
|
96
|
+
config : dict
|
|
97
|
+
configuration dictionary
|
|
98
|
+
values : list
|
|
99
|
+
list of (str, type) tuples of values and value types expected in config
|
|
100
|
+
|
|
101
|
+
Returns
|
|
102
|
+
-------
|
|
103
|
+
True if config is valid.
|
|
104
|
+
|
|
105
|
+
Raises
|
|
106
|
+
------
|
|
107
|
+
Exception if value is not found or has the wrong type.
|
|
108
|
+
"""
|
|
109
|
+
if not isinstance(config, dict):
|
|
110
|
+
raise TypeError("config must be a dictionary")
|
|
111
|
+
for value, vtype in values:
|
|
112
|
+
if value not in config:
|
|
113
|
+
raise ValueError("%s not given" % value)
|
|
114
|
+
if not isinstance(config[value], vtype):
|
|
115
|
+
raise TypeError("%s must be %s" % (value, vtype))
|
|
116
|
+
return True
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def validate_tile(tile, pyramid):
|
|
120
|
+
"""
|
|
121
|
+
Validate tile and return BufferedTile object
|
|
122
|
+
|
|
123
|
+
Parameters
|
|
124
|
+
----------
|
|
125
|
+
tile : tuple or BufferedTile
|
|
126
|
+
pyramid : BufferedTilePyramid
|
|
127
|
+
pyramid tile is being generated from if tile is tuple
|
|
128
|
+
|
|
129
|
+
Returns
|
|
130
|
+
-------
|
|
131
|
+
BufferedTile
|
|
132
|
+
|
|
133
|
+
Raises
|
|
134
|
+
------
|
|
135
|
+
TypeError if tile type is invalid.
|
|
136
|
+
"""
|
|
137
|
+
if isinstance(tile, tuple):
|
|
138
|
+
return pyramid.tile(*tile)
|
|
139
|
+
elif isinstance(tile, BufferedTile):
|
|
140
|
+
return tile
|
|
141
|
+
else:
|
|
142
|
+
raise TypeError("tile must be tuple or BufferedTile: %s" % tile)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def validate_bufferedtilepyramid(pyramid):
|
|
146
|
+
"""
|
|
147
|
+
Pyramid is BufferedTilePyramid.
|
|
148
|
+
|
|
149
|
+
Parameters
|
|
150
|
+
----------
|
|
151
|
+
pyramid : BufferedTilePyramid
|
|
152
|
+
|
|
153
|
+
Returns
|
|
154
|
+
-------
|
|
155
|
+
BufferedTilePyramid
|
|
156
|
+
|
|
157
|
+
Raises
|
|
158
|
+
------
|
|
159
|
+
TypeError if type is invalid.
|
|
160
|
+
"""
|
|
161
|
+
if isinstance(pyramid, BufferedTilePyramid):
|
|
162
|
+
return pyramid
|
|
163
|
+
else:
|
|
164
|
+
raise TypeError("pyramid must be BufferedTilePyramid")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def validate_crs(crs):
|
|
168
|
+
"""
|
|
169
|
+
Validate crs is rasterio.crs.CRS.
|
|
170
|
+
|
|
171
|
+
Parameters
|
|
172
|
+
----------
|
|
173
|
+
crs : rasterio.crs.CRS, str, int or dict
|
|
174
|
+
|
|
175
|
+
Returns
|
|
176
|
+
-------
|
|
177
|
+
rasterio.crs.CRS
|
|
178
|
+
|
|
179
|
+
Raises
|
|
180
|
+
------
|
|
181
|
+
TypeError if type is invalid.
|
|
182
|
+
"""
|
|
183
|
+
if isinstance(crs, CRS):
|
|
184
|
+
return crs
|
|
185
|
+
elif isinstance(crs, str):
|
|
186
|
+
return CRS().from_epsg(int(crs))
|
|
187
|
+
elif isinstance(crs, int):
|
|
188
|
+
return CRS().from_epsg(crs)
|
|
189
|
+
elif isinstance(crs, dict):
|
|
190
|
+
return CRS().from_dict(crs)
|
|
191
|
+
else:
|
|
192
|
+
raise TypeError("invalid CRS given")
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
##############
|
|
196
|
+
# decorators #
|
|
197
|
+
##############
|
|
198
|
+
|
|
199
|
+
def deprecated_kwargs(func):
|
|
200
|
+
"""Decorator for open() functions warning of keyword argument usage"""
|
|
201
|
+
def func_wrapper(*args, **kwargs):
|
|
202
|
+
if kwargs:
|
|
203
|
+
warnings.warn(
|
|
204
|
+
'Using kwargs such in open() is deprecated and will have no effect.'
|
|
205
|
+
)
|
|
206
|
+
if "resampling" in kwargs:
|
|
207
|
+
raise DeprecationWarning(
|
|
208
|
+
"'resampling' argument has no effect here and must be provided in read() "
|
|
209
|
+
"function."
|
|
210
|
+
)
|
|
211
|
+
return func(*args, **kwargs)
|
|
212
|
+
return func_wrapper
|
|
Binary file
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/__pycache__/main.cpython-35.pyc
ADDED
|
Binary file
|
home/ungarj/virtualenvs/p3/lib/python3.5/site-packages/mapchete/cli/__pycache__/utils.cpython-35.pyc
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -26,6 +26,14 @@ logger = logging.getLogger(__name__)
|
|
|
26
26
|
OUTPUT_FORMATS = available_output_formats()
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
def _validate_bidx(ctx, param, bidx):
|
|
30
|
+
if bidx:
|
|
31
|
+
try:
|
|
32
|
+
return list(map(int, bidx.split(",")))
|
|
33
|
+
except ValueError:
|
|
34
|
+
raise click.BadParameter("band indexes must be positive integer values")
|
|
35
|
+
|
|
36
|
+
|
|
29
37
|
@click.command(help="Convert outputs or other geodata.")
|
|
30
38
|
@utils.arg_input
|
|
31
39
|
@utils.arg_output
|
|
@@ -38,6 +46,11 @@ OUTPUT_FORMATS = available_output_formats()
|
|
|
38
46
|
type=click.Path(exists=True),
|
|
39
47
|
help="Clip output by geometry"
|
|
40
48
|
)
|
|
49
|
+
@click.option(
|
|
50
|
+
"--bidx",
|
|
51
|
+
callback=_validate_bidx,
|
|
52
|
+
help="Band indexes to copy."
|
|
53
|
+
)
|
|
41
54
|
@click.option(
|
|
42
55
|
"--output-pyramid",
|
|
43
56
|
type=click.Choice(tilematrix._conf.PYRAMID_PARAMS.keys()),
|
|
@@ -83,6 +96,11 @@ OUTPUT_FORMATS = available_output_formats()
|
|
|
83
96
|
default="cubic_spline",
|
|
84
97
|
help="Resampling method used for overviews. (default: cubic_spline)"
|
|
85
98
|
)
|
|
99
|
+
@click.option(
|
|
100
|
+
"--cog",
|
|
101
|
+
is_flag=True,
|
|
102
|
+
help="Write a valid COG. This will automatically generate verviews. (GTiff only)"
|
|
103
|
+
)
|
|
86
104
|
@utils.opt_overwrite
|
|
87
105
|
@utils.opt_verbose
|
|
88
106
|
@utils.opt_no_pbar
|
|
@@ -99,6 +117,7 @@ def convert(
|
|
|
99
117
|
point=None,
|
|
100
118
|
wkt_geometry=None,
|
|
101
119
|
clip_geometry=None,
|
|
120
|
+
bidx=None,
|
|
102
121
|
output_pyramid=None,
|
|
103
122
|
output_metatiling=None,
|
|
104
123
|
output_format=None,
|
|
@@ -109,6 +128,7 @@ def convert(
|
|
|
109
128
|
resampling_method=None,
|
|
110
129
|
overviews=False,
|
|
111
130
|
overviews_resampling_method=None,
|
|
131
|
+
cog=False,
|
|
112
132
|
overwrite=False,
|
|
113
133
|
logfile=None,
|
|
114
134
|
verbose=False,
|
|
@@ -171,14 +191,19 @@ def convert(
|
|
|
171
191
|
zoom_levels=zoom or input_info["zoom_levels"],
|
|
172
192
|
scale_ratio=scale_ratio,
|
|
173
193
|
scale_offset=scale_offset,
|
|
174
|
-
resampling=resampling_method
|
|
194
|
+
resampling=resampling_method,
|
|
195
|
+
band_indexes=bidx
|
|
175
196
|
)
|
|
176
197
|
|
|
177
198
|
# assert all required information is there
|
|
178
199
|
if mapchete_config["output"]["format"] is None:
|
|
179
200
|
# this happens if input file is e.g. JPEG2000 and output is a tile directory
|
|
180
201
|
raise click.BadOptionUsage("output-format", "Output format required.")
|
|
202
|
+
if mapchete_config["output"]["format"] == "GTiff":
|
|
203
|
+
mapchete_config["output"].update(cog=cog)
|
|
181
204
|
output_type = OUTPUT_FORMATS[mapchete_config["output"]["format"]]["data_type"]
|
|
205
|
+
if bidx is not None:
|
|
206
|
+
mapchete_config["output"].update(bands=len(bidx))
|
|
182
207
|
if mapchete_config["pyramid"] is None:
|
|
183
208
|
raise click.BadOptionUsage("output-pyramid", "Output pyramid required.")
|
|
184
209
|
elif mapchete_config["zoom_levels"] is None:
|
|
File without changes
|
|
File without changes
|
{mapchete-0.31 → home/ungarj/virtualenvs/p3/lib/python3.5/site-packages}/mapchete/cli/main.py
RENAMED
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -3,22 +3,28 @@
|
|
|
3
3
|
from shapely.geometry import LineString, mapping
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def extract_contours(
|
|
6
|
+
def extract_contours(
|
|
7
|
+
array,
|
|
8
|
+
tile,
|
|
9
|
+
interval=100,
|
|
10
|
+
field='elev',
|
|
11
|
+
base=0
|
|
12
|
+
):
|
|
7
13
|
"""
|
|
8
14
|
Extract contour lines from an array.
|
|
9
15
|
|
|
10
16
|
Parameters
|
|
11
17
|
----------
|
|
12
18
|
array : array
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
Input elevation data.
|
|
20
|
+
tile : Tile
|
|
21
|
+
Tile covering the array.
|
|
16
22
|
interval : integer
|
|
17
|
-
|
|
23
|
+
Elevation value interval when drawing contour lines.
|
|
18
24
|
field : string
|
|
19
|
-
|
|
25
|
+
Output field name containing elevation value.
|
|
20
26
|
base : integer
|
|
21
|
-
|
|
27
|
+
Elevation base value the intervals are computed from.
|
|
22
28
|
|
|
23
29
|
Returns
|
|
24
30
|
-------
|
|
@@ -86,21 +86,32 @@ def calculate_slope_aspect(elevation, xres, yres, z=1.0, scale=1.0):
|
|
|
86
86
|
return slope, aspect
|
|
87
87
|
|
|
88
88
|
|
|
89
|
-
def hillshade(
|
|
89
|
+
def hillshade(
|
|
90
|
+
elevation,
|
|
91
|
+
tile,
|
|
92
|
+
azimuth=315.0,
|
|
93
|
+
altitude=45.0,
|
|
94
|
+
z=1.0,
|
|
95
|
+
scale=1.0,
|
|
96
|
+
):
|
|
90
97
|
"""
|
|
91
98
|
Return hillshaded numpy array.
|
|
92
99
|
|
|
93
100
|
Parameters
|
|
94
101
|
----------
|
|
95
102
|
elevation : array
|
|
96
|
-
|
|
103
|
+
Input elevation data.
|
|
97
104
|
tile : Tile
|
|
98
|
-
|
|
105
|
+
Tile covering the array.
|
|
106
|
+
azimuth : float
|
|
107
|
+
Light source direction in degrees. (default: 315, top left)
|
|
108
|
+
altitude : float
|
|
109
|
+
Light source altitude angle in degrees. (default: 45)
|
|
99
110
|
z : float
|
|
100
|
-
|
|
111
|
+
Vertical DEM exaggeration factor. (default: 1)
|
|
101
112
|
scale : float
|
|
102
|
-
|
|
103
|
-
when having elevation values in meters in a geodetic projection)
|
|
113
|
+
Scale factor of pixel size units versus height units (insert 112000
|
|
114
|
+
when having elevation values in meters in a geodetic projection).
|
|
104
115
|
"""
|
|
105
116
|
elevation = elevation[0] if elevation.ndim == 3 else elevation
|
|
106
117
|
azimuth = float(azimuth)
|
|
@@ -194,6 +194,17 @@ class MapcheteConfig(object):
|
|
|
194
194
|
if mode not in ["memory", "continue", "readonly", "overwrite"]:
|
|
195
195
|
raise MapcheteConfigError("unknown mode %s" % mode)
|
|
196
196
|
self.mode = mode
|
|
197
|
+
# don't inititalize inputs on readonly mode or if only overviews are going to be
|
|
198
|
+
# built
|
|
199
|
+
self._init_inputs = False if (
|
|
200
|
+
self.mode == "readonly" or (
|
|
201
|
+
not len(
|
|
202
|
+
set(self.baselevels["zooms"]).intersection(set(self.init_zoom_levels))
|
|
203
|
+
)
|
|
204
|
+
if self.baselevels
|
|
205
|
+
else False
|
|
206
|
+
)
|
|
207
|
+
) else True
|
|
197
208
|
|
|
198
209
|
# (5) prepare process parameters per zoom level without initializing
|
|
199
210
|
# input and output classes
|
|
@@ -344,8 +355,13 @@ class MapcheteConfig(object):
|
|
|
344
355
|
"""
|
|
345
356
|
Input items used for process stored in a dictionary.
|
|
346
357
|
|
|
347
|
-
Keys are the hashes of the input parameters, values the respective
|
|
348
|
-
|
|
358
|
+
Keys are the hashes of the input parameters, values the respective InputData
|
|
359
|
+
classes.
|
|
360
|
+
|
|
361
|
+
If process mode is `readonly` or if only overviews are about to be built, no
|
|
362
|
+
inputs are required and thus not initialized due to performance reasons. However,
|
|
363
|
+
process bounds which otherwise are dependant on input bounds, may change if not
|
|
364
|
+
explicitly provided in process configuration.
|
|
349
365
|
"""
|
|
350
366
|
# get input items only of initialized zoom levels
|
|
351
367
|
raw_inputs = OrderedDict([
|
|
@@ -359,62 +375,59 @@ class MapcheteConfig(object):
|
|
|
359
375
|
if v is not None
|
|
360
376
|
])
|
|
361
377
|
|
|
362
|
-
init_as_readonly = (
|
|
363
|
-
self.mode == "readonly" or
|
|
364
|
-
(
|
|
365
|
-
# in case only overview levels are about to be built
|
|
366
|
-
not len(
|
|
367
|
-
set(self.baselevels["zooms"]).intersection(set(self.init_zoom_levels))
|
|
368
|
-
)
|
|
369
|
-
if self.baselevels
|
|
370
|
-
else False
|
|
371
|
-
)
|
|
372
|
-
)
|
|
373
|
-
|
|
374
378
|
initalized_inputs = OrderedDict()
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
379
|
+
|
|
380
|
+
if self._init_inputs:
|
|
381
|
+
for k, v in raw_inputs.items():
|
|
382
|
+
# for files and tile directories
|
|
383
|
+
if isinstance(v, str):
|
|
384
|
+
logger.debug("load input reader for simple input %s", v)
|
|
385
|
+
try:
|
|
386
|
+
reader = load_input_reader(
|
|
387
|
+
dict(
|
|
388
|
+
path=absolute_path(path=v, base_dir=self.config_dir),
|
|
389
|
+
pyramid=self.process_pyramid,
|
|
390
|
+
pixelbuffer=self.process_pyramid.pixelbuffer,
|
|
391
|
+
delimiters=self._delimiters
|
|
392
|
+
),
|
|
393
|
+
readonly=self.mode == "readonly"
|
|
394
|
+
)
|
|
395
|
+
except Exception as e:
|
|
396
|
+
logger.exception(e)
|
|
397
|
+
raise MapcheteDriverError(
|
|
398
|
+
"error when loading input %s: %s" % (v, e)
|
|
399
|
+
)
|
|
400
|
+
logger.debug("input reader for simple input %s is %s", v, reader)
|
|
401
|
+
|
|
402
|
+
# for abstract inputs
|
|
403
|
+
elif isinstance(v, dict):
|
|
404
|
+
logger.debug("load input reader for abstract input %s", v)
|
|
405
|
+
try:
|
|
406
|
+
reader = load_input_reader(
|
|
407
|
+
dict(
|
|
408
|
+
abstract=deepcopy(v),
|
|
409
|
+
pyramid=self.process_pyramid,
|
|
410
|
+
pixelbuffer=self.process_pyramid.pixelbuffer,
|
|
411
|
+
delimiters=self._delimiters,
|
|
412
|
+
conf_dir=self.config_dir
|
|
413
|
+
),
|
|
414
|
+
readonly=self.mode == "readonly"
|
|
415
|
+
)
|
|
416
|
+
except Exception as e:
|
|
417
|
+
logger.exception(e)
|
|
418
|
+
raise MapcheteDriverError(
|
|
419
|
+
"error when loading input %s: %s" % (v, e)
|
|
420
|
+
)
|
|
421
|
+
logger.debug("input reader for abstract input %s is %s", v, reader)
|
|
422
|
+
else:
|
|
423
|
+
raise MapcheteConfigError("invalid input type %s", type(v))
|
|
424
|
+
# trigger bbox creation
|
|
425
|
+
reader.bbox(out_crs=self.process_pyramid.crs)
|
|
426
|
+
initalized_inputs[k] = reader
|
|
427
|
+
|
|
428
|
+
else:
|
|
429
|
+
for k in raw_inputs.keys():
|
|
430
|
+
initalized_inputs[k] = None
|
|
418
431
|
|
|
419
432
|
return initalized_inputs
|
|
420
433
|
|
|
@@ -532,6 +545,8 @@ class MapcheteConfig(object):
|
|
|
532
545
|
-------
|
|
533
546
|
process area : shapely geometry
|
|
534
547
|
"""
|
|
548
|
+
if not self._init_inputs:
|
|
549
|
+
return box(*self.process_pyramid.bounds)
|
|
535
550
|
if zoom is None:
|
|
536
551
|
if not self._cache_full_process_area:
|
|
537
552
|
logger.debug("calculate process area ...")
|
|
@@ -541,8 +556,7 @@ class MapcheteConfig(object):
|
|
|
541
556
|
return self._cache_full_process_area
|
|
542
557
|
else:
|
|
543
558
|
if zoom not in self.init_zoom_levels:
|
|
544
|
-
raise ValueError(
|
|
545
|
-
"zoom level not available with current configuration")
|
|
559
|
+
raise ValueError("zoom level not available with current configuration")
|
|
546
560
|
return self._area_at_zoom(zoom)
|
|
547
561
|
|
|
548
562
|
def _area_at_zoom(self, zoom):
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|