rok4 2.1.4__tar.gz → 2.2.0__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.
- {rok4-2.1.4 → rok4-2.2.0}/PKG-INFO +18 -1
- {rok4-2.1.4 → rok4-2.2.0}/README.md +27 -0
- rok4-2.2.0/README.pypi.md +44 -0
- {rok4-2.1.4 → rok4-2.2.0}/pyproject.toml +1 -1
- rok4-2.2.0/src/rok4/__init__.py +1 -0
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4/pyramid.py +9 -6
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4/storage.py +5 -1
- rok4-2.2.0/src/rok4/style.py +542 -0
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4/tile_matrix_set.py +2 -0
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4/utils.py +1 -1
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4.egg-info/PKG-INFO +18 -1
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4.egg-info/SOURCES.txt +2 -0
- rok4-2.2.0/tests/test_style.py +480 -0
- rok4-2.1.4/README.pypi.md +0 -27
- rok4-2.1.4/src/rok4/__init__.py +0 -1
- {rok4-2.1.4 → rok4-2.2.0}/LICENSE.txt +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/setup.cfg +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/setup.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4/enums.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4/exceptions.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4/layer.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4/raster.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4/vector.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4.egg-info/dependency_links.txt +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4.egg-info/requires.txt +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/src/rok4.egg-info/top_level.txt +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/tests/test_layer.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/tests/test_pyramid.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/tests/test_raster.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/tests/test_storage.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/tests/test_tile_matrix_set.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/tests/test_utils.py +0 -0
- {rok4-2.1.4 → rok4-2.2.0}/tests/test_vector.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rok4
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Python core libraries for ROK4 project
|
|
5
5
|
Author-email: Géoportail IGN Developers <tout_rdev@ign.fr>
|
|
6
6
|
License:
|
|
@@ -580,4 +580,21 @@ except Exception as exc:
|
|
|
580
580
|
print(exc)
|
|
581
581
|
```
|
|
582
582
|
|
|
583
|
+
Following environment variables could be used, by module :
|
|
584
|
+
|
|
585
|
+
* `storage` : more details in the module developer documentation
|
|
586
|
+
* `ROK4_READING_LRU_CACHE_SIZE` : Cache size (0 for no limit)
|
|
587
|
+
* `ROK4_READING_LRU_CACHE_TTL` : Cache validity time (0 for no limit)
|
|
588
|
+
* `ROK4_CEPH_CONFFILE` : Ceph configuration file
|
|
589
|
+
* `ROK4_CEPH_USERNAME` : Ceph cluster user
|
|
590
|
+
* `ROK4_CEPH_CLUSTERNAME` : Ceph cluster name
|
|
591
|
+
* `ROK4_S3_KEY` : Key(s) for S3 server(s)
|
|
592
|
+
* `ROK4_S3_SECRETKEY` : Secret key(s) for S3 server(s)
|
|
593
|
+
* `ROK4_S3_URL` : URL(s) for S3 server(s)
|
|
594
|
+
* `ROK4_SSL_NO_VERIFY` : Disable SSL conrols for S3 access (any non empty value)
|
|
595
|
+
* `tile_matrix_set` :
|
|
596
|
+
* `ROK4_TMS_DIRECTORY` : Root directory (file or object) for tile matrix sets
|
|
597
|
+
* `style` :
|
|
598
|
+
* `ROK4_STYLES_DIRECTORY` : Root directory (file or object) for styles
|
|
599
|
+
|
|
583
600
|
More examples in the developer documentation
|
|
@@ -27,6 +27,33 @@ except Exception as exc:
|
|
|
27
27
|
print(exc)
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
Les variables d'environnement suivantes peuvent être nécessaires, par module :
|
|
31
|
+
|
|
32
|
+
* `storage` : plus de détails dans la documentation technique du module
|
|
33
|
+
* `ROK4_READING_LRU_CACHE_SIZE` : Nombre d'élément dans le cache de lecture (0 pour ne pas avoir de limite)
|
|
34
|
+
* `ROK4_READING_LRU_CACHE_TTL` : Durée de validité d'un élément du cache, en seconde (0 pour ne pas avoir de limite)
|
|
35
|
+
* `ROK4_CEPH_CONFFILE` : Fichier de configuration du cluster Ceph
|
|
36
|
+
* `ROK4_CEPH_USERNAME` : Compte d'accès au cluster Ceph
|
|
37
|
+
* `ROK4_CEPH_CLUSTERNAME` : Nom du cluster Ceph
|
|
38
|
+
* `ROK4_S3_KEY` : Clé(s) de(s) serveur(s) S3
|
|
39
|
+
* `ROK4_S3_SECRETKEY` : Clé(s) secrète(s) de(s) serveur(s) S3
|
|
40
|
+
* `ROK4_S3_URL` : URL de(s) serveur(s) S3
|
|
41
|
+
* `ROK4_SSL_NO_VERIFY` : Désactivation de la vérification SSL pour les accès S3 (n'importe quelle valeur non vide)
|
|
42
|
+
* `tile_matrix_set` :
|
|
43
|
+
* `ROK4_TMS_DIRECTORY` : Dossier racine (fichier ou objet) des tile matrix sets
|
|
44
|
+
* `style` :
|
|
45
|
+
* `ROK4_STYLES_DIRECTORY` : Dossier racine (fichier ou objet) des styles
|
|
46
|
+
|
|
47
|
+
Readings uses a LRU cache system with a TTL. It's possible to configure it with environment variables :
|
|
48
|
+
- ROK4_READING_LRU_CACHE_SIZE : Number of cached element. Default 64. Set 0 or a negative integer to configure a cache without bound. A power of two make cache more efficient.
|
|
49
|
+
- ROK4_READING_LRU_CACHE_TTL : Validity duration of cached element, in seconds. Default 300. 0 or negative integer to get cache without expiration date.
|
|
50
|
+
|
|
51
|
+
To disable cache (always read data on storage), set ROK4_READING_LRU_CACHE_SIZE to 1 and ROK4_READING_LRU_CACHE_TTL to 1.
|
|
52
|
+
|
|
53
|
+
Using CEPH storage requires environment variables :
|
|
54
|
+
|
|
55
|
+
Using S3 storage requires environment variables :
|
|
56
|
+
|
|
30
57
|
Plus d'exemple dans la documentation développeur.
|
|
31
58
|
|
|
32
59
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# ROK4 Python libraries
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
The `rok4` package help to use [ROK4 project](https://rok4.github.io/) concepts, like Tile Matrix Sets, data pyramids or layers.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Required system packages :
|
|
10
|
+
* debian : `apt install python3-rados python3-gdal`
|
|
11
|
+
|
|
12
|
+
The `rok4` package is available on :
|
|
13
|
+
* [PyPI](https://pypi.org/project/rok4/) : `pip install rok4`
|
|
14
|
+
* [GitHub](https://github.com/rok4/core-python/releases/) : `pip install https://github.com/rok4/core-python/releases/download/<version>/rok4-<version>-py3-none-any.whl`
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from rok4.tile_matrix_set import TileMatrixSet
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
tms = TileMatrixSet("file:///path/to/tms.json")
|
|
23
|
+
except Exception as exc:
|
|
24
|
+
print(exc)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Following environment variables could be used, by module :
|
|
28
|
+
|
|
29
|
+
* `storage` : more details in the module developer documentation
|
|
30
|
+
* `ROK4_READING_LRU_CACHE_SIZE` : Cache size (0 for no limit)
|
|
31
|
+
* `ROK4_READING_LRU_CACHE_TTL` : Cache validity time (0 for no limit)
|
|
32
|
+
* `ROK4_CEPH_CONFFILE` : Ceph configuration file
|
|
33
|
+
* `ROK4_CEPH_USERNAME` : Ceph cluster user
|
|
34
|
+
* `ROK4_CEPH_CLUSTERNAME` : Ceph cluster name
|
|
35
|
+
* `ROK4_S3_KEY` : Key(s) for S3 server(s)
|
|
36
|
+
* `ROK4_S3_SECRETKEY` : Secret key(s) for S3 server(s)
|
|
37
|
+
* `ROK4_S3_URL` : URL(s) for S3 server(s)
|
|
38
|
+
* `ROK4_SSL_NO_VERIFY` : Disable SSL conrols for S3 access (any non empty value)
|
|
39
|
+
* `tile_matrix_set` :
|
|
40
|
+
* `ROK4_TMS_DIRECTORY` : Root directory (file or object) for tile matrix sets
|
|
41
|
+
* `style` :
|
|
42
|
+
* `ROK4_STYLES_DIRECTORY` : Root directory (file or object) for styles
|
|
43
|
+
|
|
44
|
+
More examples in the developer documentation
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.0"
|
|
@@ -372,7 +372,6 @@ class Level:
|
|
|
372
372
|
|
|
373
373
|
|
|
374
374
|
class Pyramid:
|
|
375
|
-
|
|
376
375
|
"""A data pyramid, raster or vector
|
|
377
376
|
|
|
378
377
|
Attributes:
|
|
@@ -384,7 +383,7 @@ class Pyramid:
|
|
|
384
383
|
__format (str): Data format
|
|
385
384
|
__storage (Dict[str, Union[rok4.enums.StorageType,str,int]]): Pyramid's storage informations (type, root and depth if FILE storage)
|
|
386
385
|
__raster_specifications (Dict): If raster pyramid, raster specifications
|
|
387
|
-
__content (Dict): Loading status (loaded) and list content (cache).
|
|
386
|
+
__content (Dict): Loading status (loaded), slab count (count) and list content (cache).
|
|
388
387
|
|
|
389
388
|
Example (S3 storage):
|
|
390
389
|
|
|
@@ -397,6 +396,7 @@ class Pyramid:
|
|
|
397
396
|
'slab': 'DATA_18_5424_7526'
|
|
398
397
|
}
|
|
399
398
|
},
|
|
399
|
+
'count': 1,
|
|
400
400
|
'loaded': True
|
|
401
401
|
}
|
|
402
402
|
"""
|
|
@@ -409,7 +409,7 @@ class Pyramid:
|
|
|
409
409
|
descriptor (str): pyramid's descriptor path
|
|
410
410
|
|
|
411
411
|
Raises:
|
|
412
|
-
FormatError: Provided path or the
|
|
412
|
+
FormatError: Provided path or the descriptor is not a well formed JSON
|
|
413
413
|
Exception: Level issue : no one in the pyramid or the used TMS, or level ID not defined in the TMS
|
|
414
414
|
MissingAttributeError: Attribute is missing in the content
|
|
415
415
|
StorageError: Storage read issue (pyramid descriptor or TMS)
|
|
@@ -548,7 +548,7 @@ class Pyramid:
|
|
|
548
548
|
self.__levels = {}
|
|
549
549
|
self.__masks = None
|
|
550
550
|
|
|
551
|
-
self.__content = {"loaded": False, "cache": {}}
|
|
551
|
+
self.__content = {"loaded": False, "count": 0, "cache": {}}
|
|
552
552
|
|
|
553
553
|
def __str__(self) -> str:
|
|
554
554
|
return f"{self.type.name} pyramid '{self.__name}' ({self.__storage['type'].name} storage)"
|
|
@@ -737,19 +737,22 @@ class Pyramid:
|
|
|
737
737
|
else:
|
|
738
738
|
return PyramidType.RASTER
|
|
739
739
|
|
|
740
|
-
def load_list(self) ->
|
|
740
|
+
def load_list(self) -> int:
|
|
741
741
|
"""Load list content and cache it
|
|
742
742
|
|
|
743
743
|
If list is already loaded, nothing done
|
|
744
744
|
"""
|
|
745
745
|
if self.__content["loaded"]:
|
|
746
|
-
return
|
|
746
|
+
return self.__content["count"]
|
|
747
747
|
|
|
748
748
|
for slab, infos in self.list_generator():
|
|
749
749
|
self.__content["cache"][slab] = infos
|
|
750
|
+
self.__content["count"] += 1
|
|
750
751
|
|
|
751
752
|
self.__content["loaded"] = True
|
|
752
753
|
|
|
754
|
+
return self.__content["count"]
|
|
755
|
+
|
|
753
756
|
def list_generator(
|
|
754
757
|
self, level_id: str = None
|
|
755
758
|
) -> Iterator[Tuple[Tuple[SlabType, str, int, int], Dict]]:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
"""Provide functions to
|
|
1
|
+
"""Provide functions to read or write data
|
|
2
2
|
|
|
3
3
|
Available storage types are :
|
|
4
|
+
|
|
4
5
|
- S3 (path are preffixed with `s3://`)
|
|
5
6
|
- CEPH (path are prefixed with `ceph://`)
|
|
6
7
|
- FILE (path are prefixed with `file://`, but it is the default paths' interpretation)
|
|
@@ -10,17 +11,20 @@ Available storage types are :
|
|
|
10
11
|
According to functions, all storage types are not necessarily available.
|
|
11
12
|
|
|
12
13
|
Readings uses a LRU cache system with a TTL. It's possible to configure it with environment variables :
|
|
14
|
+
|
|
13
15
|
- ROK4_READING_LRU_CACHE_SIZE : Number of cached element. Default 64. Set 0 or a negative integer to configure a cache without bound. A power of two make cache more efficient.
|
|
14
16
|
- ROK4_READING_LRU_CACHE_TTL : Validity duration of cached element, in seconds. Default 300. 0 or negative integer to get cache without expiration date.
|
|
15
17
|
|
|
16
18
|
To disable cache (always read data on storage), set ROK4_READING_LRU_CACHE_SIZE to 1 and ROK4_READING_LRU_CACHE_TTL to 1.
|
|
17
19
|
|
|
18
20
|
Using CEPH storage requires environment variables :
|
|
21
|
+
|
|
19
22
|
- ROK4_CEPH_CONFFILE
|
|
20
23
|
- ROK4_CEPH_USERNAME
|
|
21
24
|
- ROK4_CEPH_CLUSTERNAME
|
|
22
25
|
|
|
23
26
|
Using S3 storage requires environment variables :
|
|
27
|
+
|
|
24
28
|
- ROK4_S3_KEY
|
|
25
29
|
- ROK4_S3_SECRETKEY
|
|
26
30
|
- ROK4_S3_URL
|