vecorel-cli 0.2.2__tar.gz → 0.2.4__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.
Files changed (77) hide show
  1. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/PKG-INFO +265 -265
  2. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/pyproject.toml +1 -1
  3. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/setup.cfg +4 -4
  4. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/conversion/base.py +16 -19
  5. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/converters.py +2 -1
  6. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/encoding/geojson.py +2 -0
  7. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/vecorel/schemas.py +107 -13
  8. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli.egg-info/PKG-INFO +265 -265
  9. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/LICENSE +0 -0
  10. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/README.md +0 -0
  11. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_convert.py +0 -0
  12. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_converters.py +0 -0
  13. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_create_geojson.py +0 -0
  14. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_create_geoparquet.py +0 -0
  15. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_create_stac.py +0 -0
  16. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_describe.py +0 -0
  17. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_encoding_auto.py +0 -0
  18. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_encoding_geojson.py +0 -0
  19. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_encoding_geoparquet.py +0 -0
  20. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_improve.py +0 -0
  21. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_jsonschema.py +0 -0
  22. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_merge.py +0 -0
  23. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_ops.py +0 -0
  24. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_rename_extension.py +0 -0
  25. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_validate.py +0 -0
  26. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/tests/test_validate_schema.py +0 -0
  27. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/__init__.py +0 -0
  28. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/basecommand.py +0 -0
  29. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/cli/__init__.py +0 -0
  30. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/cli/logger.py +0 -0
  31. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/cli/options.py +0 -0
  32. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/cli/path_url.py +0 -0
  33. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/cli/setup.py +0 -0
  34. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/cli/util.py +0 -0
  35. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/const.py +0 -0
  36. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/conversion/__init__.py +0 -0
  37. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/conversion/admin.py +0 -0
  38. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/convert.py +0 -0
  39. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/create_geojson.py +0 -0
  40. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/create_geoparquet.py +0 -0
  41. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/create_jsonschema.py +0 -0
  42. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/create_stac.py +0 -0
  43. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/datasets/__init__.py +0 -0
  44. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/datasets/template.py +0 -0
  45. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/describe.py +0 -0
  46. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/encoding/__init__.py +0 -0
  47. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/encoding/auto.py +0 -0
  48. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/encoding/base.py +0 -0
  49. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/encoding/geoparquet.py +0 -0
  50. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/improve.py +0 -0
  51. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/jsonschema/__init__.py +0 -0
  52. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/jsonschema/template.py +0 -0
  53. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/merge.py +0 -0
  54. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/parquet/__init__.py +0 -0
  55. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/parquet/geopandas.py +0 -0
  56. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/parquet/types.py +0 -0
  57. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/registry.py +0 -0
  58. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/rename_extension.py +0 -0
  59. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/validate.py +0 -0
  60. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/validate_schema.py +0 -0
  61. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/validation/__init__.py +0 -0
  62. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/validation/base.py +0 -0
  63. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/validation/data.py +0 -0
  64. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/validation/geojson.py +0 -0
  65. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/validation/geoparquet.py +0 -0
  66. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/vecorel/__init__.py +0 -0
  67. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/vecorel/collection.py +0 -0
  68. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/vecorel/extensions.py +0 -0
  69. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/vecorel/ops.py +0 -0
  70. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/vecorel/typing.py +0 -0
  71. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/vecorel/util.py +0 -0
  72. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli/vecorel/version.py +0 -0
  73. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli.egg-info/SOURCES.txt +0 -0
  74. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli.egg-info/dependency_links.txt +0 -0
  75. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli.egg-info/entry_points.txt +0 -0
  76. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli.egg-info/requires.txt +0 -0
  77. {vecorel_cli-0.2.2 → vecorel_cli-0.2.4}/vecorel_cli.egg-info/top_level.txt +0 -0
@@ -1,265 +1,265 @@
1
- Metadata-Version: 2.4
2
- Name: vecorel-cli
3
- Version: 0.2.2
4
- Summary: CLI tools such as validation and file format conversion for vecorel.
5
- Author: Matthias Mohr
6
- License-Expression: Apache-2.0
7
- Project-URL: Homepage, https://github.com/vecorel/cli
8
- Project-URL: Bug Reports, https://github.com/vecorel/cli/issues
9
- Project-URL: Source, https://github.com/vecorel/cli
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Programming Language :: Python :: 3.13
16
- Requires-Python: >=3.10
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
- Requires-Dist: pyyaml<7.0,>=6.0
20
- Requires-Dist: click<9.0,>=8.1
21
- Requires-Dist: geopandas<2.0,>=1.0.0
22
- Requires-Dist: requests<3.0,>=2.30
23
- Requires-Dist: shapely<3.0,>=2.1
24
- Requires-Dist: numpy<2.2,>=2.0
25
- Requires-Dist: pyarrow<22.0,>=21.0
26
- Requires-Dist: py7zr<2.0,>=1.0
27
- Requires-Dist: fsspec==2025.7.0
28
- Requires-Dist: jsonschema[format]<5.0,>=4.20
29
- Requires-Dist: aiohttp<4.0,>=3.9
30
- Requires-Dist: yarl<2.0,>=1.20
31
- Requires-Dist: rarfile<5.0,>=4.0
32
- Requires-Dist: semantic-version<3.0,>=2.10.0
33
- Requires-Dist: json-stream<3.0,>=2.3.0
34
- Requires-Dist: flatdict<5.0,>=4.0
35
- Requires-Dist: loguru==0.7.3
36
- Dynamic: license-file
37
-
38
- # Vecorel CLI
39
-
40
- A command-line interface (CLI) for working with Vecorel files.
41
-
42
- - [Getting Started](#getting-started)
43
- - [Documentation / Commands](#commands)
44
- - [Development](#development)
45
-
46
- ## Getting Started
47
-
48
- In order to make working with Vecorel easier we have developed command-line interface (CLI) tools such as
49
- inspection, validation and file format conversions.
50
-
51
- ### Installation
52
-
53
- #### Using Pixi (Recommended)
54
-
55
- This project uses [Pixi](https://pixi.sh/) for dependency management. Install Pixi first, then:
56
-
57
- ```bash
58
- # Clone the repository and navigate to it
59
- git clone https://github.com/vecorel/cli.git
60
- cd cli
61
-
62
- # Install all dependencies
63
- pixi install
64
-
65
- # Run the CLI
66
- pixi run vec
67
- ```
68
-
69
- > **Note**: This project recently migrated to Pixi. If you were using the old pip-based workflow, see [MIGRATION.md](MIGRATION.md) for details.
70
-
71
- #### Using pip
72
-
73
- Alternatively, you can install from PyPI with **Python 3.10** or any later version:
74
-
75
- ```bash
76
- pip install vecorel-cli
77
- ```
78
-
79
- ### Execute a command
80
-
81
- After the installation you should be able to run the following command: `vec` (or `pixi run vec` if using Pixi)
82
-
83
- You should see usage instructions and [available commands](#commands) for the CLI.
84
-
85
- Vecorel CLI supports various commands to work with the files:
86
-
87
- - [Vecorel CLI](#vecorel-cli)
88
- - [Getting Started](#getting-started)
89
- - [Installation](#installation)
90
- - [Using Pixi (Recommended)](#using-pixi-recommended)
91
- - [Using pip](#using-pip)
92
- - [Execute a command](#execute-a-command)
93
- - [Commands](#commands)
94
- - [Validation](#validation)
95
- - [Create Vecorel GeoParquet from GeoJSON](#create-vecorel-geoparquet-from-geojson)
96
- - [Create Vecorel GeoJSON from GeoParquet](#create-vecorel-geojson-from-geoparquet)
97
- - [Inspect Vecorel GeoParquet file](#inspect-vecorel-geoparquet-file)
98
- - [Merge Vecorel GeoParquet files](#merge-vecorel-geoparquet-files)
99
- - [Create JSON Schema from Vecorel Schema](#create-json-schema-from-vecorel-schema)
100
- - [Validate a Vecorel Schema](#validate-a-vecorel-schema)
101
- - [Improve a Vecorel Parquet file](#improve-a-vecorel-parquet-file)
102
- - [Update an extension template with new names](#update-an-extension-template-with-new-names)
103
- - [Converter for existing datasets](#converter-for-existing-datasets)
104
- - [Development](#development)
105
- - [Implement a converter](#implement-a-converter)
106
-
107
- ## Commands
108
-
109
- ### Validation
110
-
111
- To validate a Vecorel GeoParquet or GeoJSON file, you can for example run:
112
-
113
- - GeoJSON: `vec validate example.json --collection collection.json`
114
- - GeoParquet: `vec validate example.parquet --data`
115
-
116
- Check `vec validate --help` for more details.
117
-
118
- The validator also supports remote files.
119
-
120
- - `http://` or `https://`: no further configuration is needed.
121
- - `s3://`: With Pixi, run `pixi install -e s3` or with pip, run `pip install vecorel-cli[s3]` and you may need to set environment variables.
122
- Refer to the [s3fs credentials documentation](https://s3fs.readthedocs.io/en/latest/#credentials) for how to define credentials.
123
- - `gs://`: With Pixi, run `pixi install -e gcs` or with pip, run `pip install vecorel-cli[gcs]`.
124
- By default, `gcsfs` will attempt to use your default gcloud credentials or, attempt to get credentials from the google metadata service, or fall back to anonymous access.
125
-
126
- ### Create Vecorel GeoParquet from GeoJSON
127
-
128
- To create a Vecorel-compliant GeoParquet for a Vecorel-compliant set of GeoJSON files containing Features or FeatureCollections,
129
- you can for example run:
130
-
131
- - `vec create-geoparquet geojson/example.json -o example.parquet -c geojson/collection.json`
132
-
133
- Check `vec create-geoparquet --help` for more details.
134
-
135
- ### Create Vecorel GeoJSON from GeoParquet
136
-
137
- To create one or multiple Vecorel-compliant GeoJSON file(s) for a Vecorel-compliant GeoParquet file,
138
- you can for example run:
139
-
140
- - GeoJSON FeatureCollection:
141
- `vec create-geojson example.parquet -o dest-folder`
142
- - GeoJSON Features (with indentation and max. 100 features):
143
- `vec create-geojson example.parquet -o dest-folder -n 100 -i 2 -f`
144
-
145
- `vec create-geojson example.parquet -o dest-folder -n 100 -i 2 -f`
146
-
147
- Check `vec create-geojson --help` for more details.
148
-
149
- ### Inspect Vecorel GeoParquet file
150
-
151
- To look into a Vecorel GeoParquet file to get a rough understanding of the content, the following can be executed:
152
-
153
- - `vec describe example.parquet`
154
-
155
- Check `vec describe --help` for more details.
156
-
157
- ### Merge Vecorel GeoParquet files
158
-
159
- Merges multiple Vecorel datasets to a combined Vecorel dataset:
160
-
161
- - `vec merge ec_ee.parquet ec_lv.parquet -o merged.parquet -e https://vecorel.org/hcat-extension/v0.1.0/schema.yaml -i ec:hcat_name -i ec:hcat_code -i ec:translated_name`
162
-
163
- Check `vec merge --help` for more details.
164
-
165
- ### Create JSON Schema from Vecorel Schema
166
-
167
- To create a JSON Schema for a Vecorel Schema YAML file, you can for example run:
168
-
169
- - `vec jsonschema example.json --id=https://vecorel.org/specification/v0.1.0/geojson/schema.json -o schema.json`
170
-
171
- Check `vec jsonschema --help` for more details.
172
-
173
- ### Validate a Vecorel Schema
174
-
175
- To validate a Vecorel Schema YAML file, you can for example run:
176
-
177
- - `vec validate-schema schema/schema.yaml`
178
-
179
- Check `vec validate-schema --help` for more details.
180
-
181
- ### Improve a Vecorel Parquet file
182
-
183
- Various "improvements" can be applied to a Vecorel GeoParquet file.
184
- The commands allows to
185
-
186
- - change the CRS (`--crs`)
187
- - change the GeoParquet version (`-gp1`) and compression (`-pc`)
188
- - add/fill missing perimeter/area values (`-sz`)
189
- - fix invalid geometries (`-g`)
190
- - rename columns (`-r`)
191
-
192
- Example:
193
-
194
- - `vec improve file.parquet -o file2.parquet -g -sz -r old=new -pc zstd`
195
-
196
- Check `vec improve --help` for more details.
197
-
198
- ### Update an extension template with new names
199
-
200
- Once you've created and git cloned a new extension, you can use the CLI
201
- to update all template placeholders with proper names.
202
-
203
- For example, if your extension is meant to have
204
-
205
- - the title "Administrative Division Extension",
206
- - the prefix `admin` (e.g. field `admin:country_code` or `admin:subdivision_code`),
207
- - is hosted at `https://github.io/vecorel/administrative-division-extension`
208
- (organization: `vecorel`, repository `/administrative-division-extension`),
209
- - and you run Vecorel in the folder of the extension.
210
-
211
- Then the following command could be used:
212
-
213
- - `vec rename-extension . -t "Administrative Division" -p admin -s administrative-division-extension -o vecorel`
214
-
215
- Check `vec rename-extension --help` for more details.
216
-
217
- ### Converter for existing datasets
218
-
219
- The CLI ships various converters for existing datasets.
220
-
221
- To get a list of available converters/datasets with title, license, etc. run:
222
-
223
- - `vec converters`
224
-
225
- Use any of the IDs from the list to convert an existing dataset to Vecorel:
226
-
227
- - `vec convert de_nrw`
228
-
229
- See [Implement a converter](#implement-a-converter) for details about how to
230
-
231
- ## Development
232
-
233
- This project uses [Pixi](https://pixi.sh/) for dependency management and development workflows.
234
-
235
- ```bash
236
- # Install all dependencies including development tools
237
- pixi install -e dev
238
-
239
- # Install the package in editable mode
240
- pixi run install-dev
241
-
242
- # Run tests
243
- pixi run test
244
-
245
- # Format and lint code
246
- pixi run format
247
- pixi run lint
248
-
249
- # Run all checks (lint, format, test)
250
- pixi run check
251
-
252
- # Install and run pre-commit
253
- pixi run pre-commit-install
254
- pixi run pre-commit-run
255
- ```
256
-
257
- ### Implement a converter
258
-
259
- The following high-level description gives an idea how to implement a converter in Vecorel CLI:
260
-
261
- 1. Create a new file in `vecorel_cli/datasets` based on the `template.py`
262
- 2. Fill in the required variables / test it / run it
263
- 3. Add missing dependencies into the appropriate feature group in `pixi.toml` (or `setup.py` for pip users)
264
- 4. Add the converter to the list above
265
- 5. Create a PR to submit your converter for review
1
+ Metadata-Version: 2.4
2
+ Name: vecorel-cli
3
+ Version: 0.2.4
4
+ Summary: CLI tools such as validation and file format conversion for vecorel.
5
+ Author: Matthias Mohr
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/vecorel/cli
8
+ Project-URL: Bug Reports, https://github.com/vecorel/cli/issues
9
+ Project-URL: Source, https://github.com/vecorel/cli
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: pyyaml<7.0,>=6.0
20
+ Requires-Dist: click<9.0,>=8.1
21
+ Requires-Dist: geopandas<2.0,>=1.0.0
22
+ Requires-Dist: requests<3.0,>=2.30
23
+ Requires-Dist: shapely<3.0,>=2.1
24
+ Requires-Dist: numpy<2.2,>=2.0
25
+ Requires-Dist: pyarrow<22.0,>=21.0
26
+ Requires-Dist: py7zr<2.0,>=1.0
27
+ Requires-Dist: fsspec==2025.7.0
28
+ Requires-Dist: jsonschema[format]<5.0,>=4.20
29
+ Requires-Dist: aiohttp<4.0,>=3.9
30
+ Requires-Dist: yarl<2.0,>=1.20
31
+ Requires-Dist: rarfile<5.0,>=4.0
32
+ Requires-Dist: semantic-version<3.0,>=2.10.0
33
+ Requires-Dist: json-stream<3.0,>=2.3.0
34
+ Requires-Dist: flatdict<5.0,>=4.0
35
+ Requires-Dist: loguru==0.7.3
36
+ Dynamic: license-file
37
+
38
+ # Vecorel CLI
39
+
40
+ A command-line interface (CLI) for working with Vecorel files.
41
+
42
+ - [Getting Started](#getting-started)
43
+ - [Documentation / Commands](#commands)
44
+ - [Development](#development)
45
+
46
+ ## Getting Started
47
+
48
+ In order to make working with Vecorel easier we have developed command-line interface (CLI) tools such as
49
+ inspection, validation and file format conversions.
50
+
51
+ ### Installation
52
+
53
+ #### Using Pixi (Recommended)
54
+
55
+ This project uses [Pixi](https://pixi.sh/) for dependency management. Install Pixi first, then:
56
+
57
+ ```bash
58
+ # Clone the repository and navigate to it
59
+ git clone https://github.com/vecorel/cli.git
60
+ cd cli
61
+
62
+ # Install all dependencies
63
+ pixi install
64
+
65
+ # Run the CLI
66
+ pixi run vec
67
+ ```
68
+
69
+ > **Note**: This project recently migrated to Pixi. If you were using the old pip-based workflow, see [MIGRATION.md](MIGRATION.md) for details.
70
+
71
+ #### Using pip
72
+
73
+ Alternatively, you can install from PyPI with **Python 3.10** or any later version:
74
+
75
+ ```bash
76
+ pip install vecorel-cli
77
+ ```
78
+
79
+ ### Execute a command
80
+
81
+ After the installation you should be able to run the following command: `vec` (or `pixi run vec` if using Pixi)
82
+
83
+ You should see usage instructions and [available commands](#commands) for the CLI.
84
+
85
+ Vecorel CLI supports various commands to work with the files:
86
+
87
+ - [Vecorel CLI](#vecorel-cli)
88
+ - [Getting Started](#getting-started)
89
+ - [Installation](#installation)
90
+ - [Using Pixi (Recommended)](#using-pixi-recommended)
91
+ - [Using pip](#using-pip)
92
+ - [Execute a command](#execute-a-command)
93
+ - [Commands](#commands)
94
+ - [Validation](#validation)
95
+ - [Create Vecorel GeoParquet from GeoJSON](#create-vecorel-geoparquet-from-geojson)
96
+ - [Create Vecorel GeoJSON from GeoParquet](#create-vecorel-geojson-from-geoparquet)
97
+ - [Inspect Vecorel GeoParquet file](#inspect-vecorel-geoparquet-file)
98
+ - [Merge Vecorel GeoParquet files](#merge-vecorel-geoparquet-files)
99
+ - [Create JSON Schema from Vecorel Schema](#create-json-schema-from-vecorel-schema)
100
+ - [Validate a Vecorel Schema](#validate-a-vecorel-schema)
101
+ - [Improve a Vecorel Parquet file](#improve-a-vecorel-parquet-file)
102
+ - [Update an extension template with new names](#update-an-extension-template-with-new-names)
103
+ - [Converter for existing datasets](#converter-for-existing-datasets)
104
+ - [Development](#development)
105
+ - [Implement a converter](#implement-a-converter)
106
+
107
+ ## Commands
108
+
109
+ ### Validation
110
+
111
+ To validate a Vecorel GeoParquet or GeoJSON file, you can for example run:
112
+
113
+ - GeoJSON: `vec validate example.json --collection collection.json`
114
+ - GeoParquet: `vec validate example.parquet --data`
115
+
116
+ Check `vec validate --help` for more details.
117
+
118
+ The validator also supports remote files.
119
+
120
+ - `http://` or `https://`: no further configuration is needed.
121
+ - `s3://`: With Pixi, run `pixi install -e s3` or with pip, run `pip install vecorel-cli[s3]` and you may need to set environment variables.
122
+ Refer to the [s3fs credentials documentation](https://s3fs.readthedocs.io/en/latest/#credentials) for how to define credentials.
123
+ - `gs://`: With Pixi, run `pixi install -e gcs` or with pip, run `pip install vecorel-cli[gcs]`.
124
+ By default, `gcsfs` will attempt to use your default gcloud credentials or, attempt to get credentials from the google metadata service, or fall back to anonymous access.
125
+
126
+ ### Create Vecorel GeoParquet from GeoJSON
127
+
128
+ To create a Vecorel-compliant GeoParquet for a Vecorel-compliant set of GeoJSON files containing Features or FeatureCollections,
129
+ you can for example run:
130
+
131
+ - `vec create-geoparquet geojson/example.json -o example.parquet -c geojson/collection.json`
132
+
133
+ Check `vec create-geoparquet --help` for more details.
134
+
135
+ ### Create Vecorel GeoJSON from GeoParquet
136
+
137
+ To create one or multiple Vecorel-compliant GeoJSON file(s) for a Vecorel-compliant GeoParquet file,
138
+ you can for example run:
139
+
140
+ - GeoJSON FeatureCollection:
141
+ `vec create-geojson example.parquet -o dest-folder`
142
+ - GeoJSON Features (with indentation and max. 100 features):
143
+ `vec create-geojson example.parquet -o dest-folder -n 100 -i 2 -f`
144
+
145
+ `vec create-geojson example.parquet -o dest-folder -n 100 -i 2 -f`
146
+
147
+ Check `vec create-geojson --help` for more details.
148
+
149
+ ### Inspect Vecorel GeoParquet file
150
+
151
+ To look into a Vecorel GeoParquet file to get a rough understanding of the content, the following can be executed:
152
+
153
+ - `vec describe example.parquet`
154
+
155
+ Check `vec describe --help` for more details.
156
+
157
+ ### Merge Vecorel GeoParquet files
158
+
159
+ Merges multiple Vecorel datasets to a combined Vecorel dataset:
160
+
161
+ - `vec merge ec_ee.parquet ec_lv.parquet -o merged.parquet -e https://vecorel.org/hcat-extension/v0.1.0/schema.yaml -i ec:hcat_name -i ec:hcat_code -i ec:translated_name`
162
+
163
+ Check `vec merge --help` for more details.
164
+
165
+ ### Create JSON Schema from Vecorel Schema
166
+
167
+ To create a JSON Schema for a Vecorel Schema YAML file, you can for example run:
168
+
169
+ - `vec jsonschema example.json --id=https://vecorel.org/specification/v0.1.0/geojson/schema.json -o schema.json`
170
+
171
+ Check `vec jsonschema --help` for more details.
172
+
173
+ ### Validate a Vecorel Schema
174
+
175
+ To validate a Vecorel Schema YAML file, you can for example run:
176
+
177
+ - `vec validate-schema schema/schema.yaml`
178
+
179
+ Check `vec validate-schema --help` for more details.
180
+
181
+ ### Improve a Vecorel Parquet file
182
+
183
+ Various "improvements" can be applied to a Vecorel GeoParquet file.
184
+ The commands allows to
185
+
186
+ - change the CRS (`--crs`)
187
+ - change the GeoParquet version (`-gp1`) and compression (`-pc`)
188
+ - add/fill missing perimeter/area values (`-sz`)
189
+ - fix invalid geometries (`-g`)
190
+ - rename columns (`-r`)
191
+
192
+ Example:
193
+
194
+ - `vec improve file.parquet -o file2.parquet -g -sz -r old=new -pc zstd`
195
+
196
+ Check `vec improve --help` for more details.
197
+
198
+ ### Update an extension template with new names
199
+
200
+ Once you've created and git cloned a new extension, you can use the CLI
201
+ to update all template placeholders with proper names.
202
+
203
+ For example, if your extension is meant to have
204
+
205
+ - the title "Administrative Division Extension",
206
+ - the prefix `admin` (e.g. field `admin:country_code` or `admin:subdivision_code`),
207
+ - is hosted at `https://github.io/vecorel/administrative-division-extension`
208
+ (organization: `vecorel`, repository `/administrative-division-extension`),
209
+ - and you run Vecorel in the folder of the extension.
210
+
211
+ Then the following command could be used:
212
+
213
+ - `vec rename-extension . -t "Administrative Division" -p admin -s administrative-division-extension -o vecorel`
214
+
215
+ Check `vec rename-extension --help` for more details.
216
+
217
+ ### Converter for existing datasets
218
+
219
+ The CLI ships various converters for existing datasets.
220
+
221
+ To get a list of available converters/datasets with title, license, etc. run:
222
+
223
+ - `vec converters`
224
+
225
+ Use any of the IDs from the list to convert an existing dataset to Vecorel:
226
+
227
+ - `vec convert de_nrw`
228
+
229
+ See [Implement a converter](#implement-a-converter) for details about how to
230
+
231
+ ## Development
232
+
233
+ This project uses [Pixi](https://pixi.sh/) for dependency management and development workflows.
234
+
235
+ ```bash
236
+ # Install all dependencies including development tools
237
+ pixi install -e dev
238
+
239
+ # Install the package in editable mode
240
+ pixi run install-dev
241
+
242
+ # Run tests
243
+ pixi run test
244
+
245
+ # Format and lint code
246
+ pixi run format
247
+ pixi run lint
248
+
249
+ # Run all checks (lint, format, test)
250
+ pixi run check
251
+
252
+ # Install and run pre-commit
253
+ pixi run pre-commit-install
254
+ pixi run pre-commit-run
255
+ ```
256
+
257
+ ### Implement a converter
258
+
259
+ The following high-level description gives an idea how to implement a converter in Vecorel CLI:
260
+
261
+ 1. Create a new file in `vecorel_cli/datasets` based on the `template.py`
262
+ 2. Fill in the required variables / test it / run it
263
+ 3. Add missing dependencies into the appropriate feature group in `pixi.toml` (or `setup.py` for pip users)
264
+ 4. Add the converter to the list above
265
+ 5. Create a PR to submit your converter for review
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vecorel-cli"
7
- version = "0.2.2"
7
+ version = "0.2.4"
8
8
  description = "CLI tools such as validation and file format conversion for vecorel."
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -243,27 +243,24 @@ class BaseConverter(LoggerMixin):
243
243
  return pd.concat(gdfs)
244
244
 
245
245
  def filter_rows(self, gdf):
246
- if len(self.column_filters) > 0:
247
- self.info("Applying filters")
248
- for key, fn in self.column_filters.items():
249
- if key in gdf.columns:
250
- result = fn(gdf[key])
246
+ if len(self.column_filters) == 0:
247
+ return gdf
248
+
249
+ self.info("Applying filters")
250
+ for key, fn in self.column_filters.items():
251
+ if key in gdf.columns:
252
+ result = fn(gdf[key])
253
+ if isinstance(result, tuple):
251
254
  # If the result is a tuple, the second value is a flag to potentially invert the mask
252
- if isinstance(result, tuple):
253
- if result[1]:
254
- # Invert mask
255
- mask = ~result[0]
256
- else:
257
- # Use mask as is
258
- mask = result[0]
259
- else:
260
- # Just got a mask, proceed
261
- mask = result
262
-
263
- # Filter columns based on the mask
264
- gdf = gdf[mask]
255
+ mask = ~result[0] if result[1] else result[0]
265
256
  else:
266
- self.warning(f"Column '{key}' not found in dataset, skipping filter")
257
+ # Just got a mask, proceed
258
+ mask = result
259
+
260
+ # Filter columns based on the mask
261
+ gdf = gdf[mask]
262
+ else:
263
+ self.warning(f"Column '{key}' not found in dataset, skipping filter")
267
264
  return gdf
268
265
 
269
266
  def get_title(self):
@@ -1,5 +1,6 @@
1
1
  import importlib
2
2
  import os
3
+ from typing import Sequence
3
4
 
4
5
  import click
5
6
  import pandas as pd
@@ -111,7 +112,7 @@ class Converters(BaseCommand):
111
112
  ids = [f[:-3] for f in files if self.is_converter(f)]
112
113
  return ids
113
114
 
114
- def list_all(self, keys=["short_name", "license"]) -> dict:
115
+ def list_all(self, keys: Sequence[str] = ("short_name", "license")) -> dict:
115
116
  converters = {}
116
117
  for id in self.list_ids():
117
118
  obj = {}
@@ -336,5 +336,7 @@ class VecorelJSONEncoder(json.JSONEncoder):
336
336
  return obj.tolist()
337
337
  elif isinstance(obj, set):
338
338
  return list(obj)
339
+ elif isinstance(obj, np.generic):
340
+ return obj.item()
339
341
  else:
340
342
  return super().default(obj)