1
- # SpatioTemporal Asset Catalog (STAC) Validator
1
+ # SpatioTemporal Asset Catalog Validator
2
+
3
+ <!-- markdownlint-disable MD033 MD041 -->
4
+
5
+ <p align =" left " >
6
+ <img src =" assets/stac-validator.png " width =560 >
7
+ </p >
8
+
9
+ [ ![ Downloads] ( https://static.pepy.tech/badge/stac-validator?color=blue )] ( https://pepy.tech/project/stac-validator )
10
+ [ ![ GitHub contributors] ( https://img.shields.io/github/contributors/stac-utils/stac-validator?color=blue )] ( https://github.com/stac-utils/stac-validator/graphs/contributors )
11
+ [ ![ GitHub stars] ( https://img.shields.io/github/stars/stac-utils/stac-validator.svg?color=blue )] ( https://github.com/stac-utils/stac-validator/stargazers )
12
+ [ ![ GitHub forks] ( https://img.shields.io/github/forks/stac-utils/stac-validator.svg?color=blue )] ( https://github.com/stac-utils/stac-validator/network/members )
13
+ [ ![ PyPI version] ( https://img.shields.io/pypi/v/stac-validator.svg?color=blue )] ( https://pypi.org/project/stac-validator/ )
14
+ [ ![ STAC] ( https://img.shields.io/badge/STAC-1.1.0-blue.svg )] ( https://github.com/radiantearth/stac-spec/tree/v1.1.0 )
15
+
16
+ ## Table of Contents
17
+
18
+ - [ Overview] ( #overview )
19
+ - [ Documentation] ( #documentation )
20
+ - [ Requirements] ( #requirements )
21
+ - [ Installation] ( #install )
22
+ - [ Supported STAC Versions] ( #versions-supported )
23
+ - [ Usage] ( #usage )
24
+ - [ CLI] ( #cli )
25
+ - [ Python] ( #python )
26
+ - [ Examples] ( #additional-examples )
27
+ - [ Core Validation] ( #--core )
28
+ - [ Custom Schema] ( #--custom )
29
+ - [ Extensions Validation] ( #--extensions )
30
+ - [ Recursive Validation] ( #--recursive )
31
+ - [ Item Collection Validation] ( #--item-collection )
32
+ - [ Using Headers] ( #--header )
33
+ - [ Schema Mapping] ( #--schema-map )
34
+ - [ Deployment] ( #deployment )
35
+ - [ Docker] ( #docker )
36
+ - [ AWS (CDK)] ( #aws-cdk )
37
+ - [ Testing] ( #testing )
38
+ - [ Related Projects] ( #related-projects )
39
+ - [ Sponsors and Supporters] ( #sponsors-and-supporters )
40
+ - [ Contributing] ( #contributing )
41
+ - [ License] ( #license )
42
+
43
+ ## Overview
44
+
45
+ STAC Validator is a tool to validate [ STAC (SpatioTemporal Asset Catalog)] ( https://github.com/radiantearth/stac-spec ) json files against the official STAC specification. It provides both a command-line interface and a Python API for validating STAC objects.
2
46
3
47
## Documentation
4
48
5
- [ read the docs] ( https://stac-validator.readthedocs.io/en/latest/ )
49
+ For detailed documentation, please visit [ read the docs] ( https://stac-validator.readthedocs.io/en/latest/ ) .
6
50
7
51
## Validate STAC json files against the [ STAC spec] ( https://github.com/radiantearth/stac-spec ) .
8
52
9
53
``` bash
10
- stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json
54
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json
55
+ ```
56
+
57
+ ``` bash
11
58
[
12
59
{
13
60
" version" : " 1.0.0" ,
@@ -34,33 +81,35 @@ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/e
34
81
- Click
35
82
- Jsonschema
36
83
84
+ ## Related Projects
85
+
37
86
Note: Stac-validator is also used in stac-check which adds linting messages based on the official STAC best practices document.
38
87
https://github.com/stac-utils/stac-check
39
88
40
89
## Install
41
90
42
- Installation from PyPi
91
+ ### Installation from PyPi
43
92
44
93
``` bash
45
- pip install stac-validator
94
+ $ pip install stac-validator
46
95
```
47
96
48
- Installation from Repo
97
+ ### Installation from Repo
49
98
50
99
``` bash
51
- pip install .
100
+ $ pip install .
52
101
```
53
102
54
103
or for local development
55
104
56
105
``` bash
57
- pip install -e ' .[dev]'
106
+ $ pip install -e ' .[dev]'
58
107
```
59
108
60
109
The [ Makefile] ( ./Makefile ) has convenience commands if Make is installed.
61
110
62
111
``` bash
63
- make help
112
+ $ make help
64
113
```
65
114
66
115
## Versions supported
@@ -80,14 +129,17 @@ make help
80
129
| 1.1.0-beta.1 |
81
130
| 1.1.0 |
82
131
83
- ---
132
+ ## Usage
84
133
85
- # CLI
134
+ ### CLI
86
135
87
136
** Basic Usage**
88
137
89
138
``` bash
90
- stac-validator --help
139
+ $ stac-validator --help
140
+ ```
141
+
142
+ ``` bash
91
143
Usage: stac-validator [OPTIONS] STAC_FILE
92
144
93
145
Options:
@@ -122,46 +174,10 @@ Options:
122
174
--no_output Do not print output to console.
123
175
--log_file TEXT Save full recursive output to log file
124
176
(local filepath).
125
- --help Show this message and exit.` ` `
126
-
127
- ---
128
-
129
- # Deployment
130
-
131
- # # Docker
132
-
133
- The validator can run using docker containers.
134
-
135
- ` ` ` bash
136
- docker build -t stac-validator .
137
- docker run stac-validator https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json
138
- [
139
- {
140
- " version" : " 1.0.0" ,
141
- " path" : " https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json" ,
142
- " schema" : [
143
- " https://stac-extensions.github.io/projection/v1.0.0/schema.json" ,
144
- " https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json"
145
- ],
146
- " valid_stac" : true,
147
- " asset_type" : " ITEM" ,
148
- " validation_method" : " default"
149
- }
150
- ]
151
- ` ` `
152
-
153
- # # AWS (CDK)
154
-
155
- An example [AWS CDK](https://aws.amazon.com/cdk/) deployment is available in [cdk-deployment](./cdk-deployment/README.md)
156
-
157
- ` ` ` bash
158
- cd cdk-deployment
159
- cdk diff
177
+ --help Show this message and exit.
160
178
` ` `
161
179
162
- ---
163
-
164
- # Python
180
+ # ## Python
165
181
166
182
** Remote source**
167
183
@@ -171,6 +187,8 @@ from stac_validator import stac_validator
171
187
stac = stac_validator.StacValidate(" https://raw.githubusercontent.com/stac-utils/pystac/main/tests/data-files/examples/0.9.0/collection-spec/examples/landsat-collection.json" )
172
188
stac.run ()
173
189
print(stac.message)
190
+ ` ` `
191
+ ` ` ` python
174
192
[
175
193
{
176
194
" version" : " 0.9.0" ,
@@ -193,6 +211,8 @@ from stac_validator import stac_validator
193
211
stac = stac_validator.StacValidate(" tests/test_data/1beta1/sentinel2.json" , extensions=True)
194
212
stac.run ()
195
213
print(stac.message)
214
+ ` ` `
215
+ ` ` ` python
196
216
[
197
217
{
198
218
" version" : " 1.0.0-beta.1" ,
@@ -227,26 +247,61 @@ stac.validate_item_collection_dict(item_collection_dict)
227
247
print(stac.message)
228
248
` ` `
229
249
230
- ---
250
+ # # Deployment
231
251
232
- # Testing
252
+ # ## Docker
253
+
254
+ The validator can run using docker containers.
233
255
234
256
` ` ` bash
235
- make test
257
+ $ docker build -t stac-validator .
258
+ $ docker run stac-validator https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json
259
+ ` ` `
260
+
261
+ ` ` ` bash
262
+ [
263
+ {
264
+ " version" : " 1.0.0" ,
265
+ " path" : " https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json" ,
266
+ " schema" : [
267
+ " https://stac-extensions.github.io/projection/v1.0.0/schema.json" ,
268
+ " https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json"
269
+ ],
270
+ " valid_stac" : true,
271
+ " asset_type" : " ITEM" ,
272
+ " validation_method" : " default"
273
+ }
274
+ ]
275
+ ` ` `
276
+
277
+ # ## AWS (CDK)
278
+
279
+ An example [AWS CDK](https://aws.amazon.com/cdk/) deployment is available in [cdk-deployment](./cdk-deployment/README.md)
280
+
281
+ ` ` ` bash
282
+ $ cd cdk-deployment
283
+ $ cdk diff
284
+ ` ` `
285
+
286
+ # # Testing
287
+
288
+ ` ` ` bash
289
+ $ make test
236
290
# or
237
- pytest -v
291
+ $ pytest -v
238
292
` ` `
239
293
240
294
See the [tests](./tests/test_stac_validator.py) files for examples on different usages.
241
295
242
- ---
296
+ # # Additional Examples
243
297
244
- # Additional Examples
298
+ # ## --core
245
299
246
- ** --core**
300
+ ` ` ` bash
301
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --core
302
+ ` ` `
247
303
248
304
` ` ` bash
249
- stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --core
250
305
[
251
306
{
252
307
" version" : " 1.0.0" ,
@@ -261,10 +316,13 @@ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/e
261
316
]
262
317
` ` `
263
318
264
- ** --custom**
319
+ # ## --custom
320
+
321
+ ` ` ` bash
322
+ $ stac-validator https://radarstac.s3.amazonaws.com/stac/catalog.json --custom https://cdn.staclint.com/v0.7.0/catalog.json
323
+ ` ` `
265
324
266
325
` ` ` bash
267
- stac-validator https://radarstac.s3.amazonaws.com/stac/catalog.json --custom https://cdn.staclint.com/v0.7.0/catalog.json
268
326
[
269
327
{
270
328
" version" : " 0.7.0" ,
@@ -279,10 +337,13 @@ stac-validator https://radarstac.s3.amazonaws.com/stac/catalog.json --custom htt
279
337
]
280
338
` ` `
281
339
282
- ** --extensions**
340
+ # ## --extensions
341
+
342
+ ` ` ` bash
343
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --extensions
344
+ ` ` `
283
345
284
346
` ` ` bash
285
- stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --extensions
286
347
[
287
348
{
288
349
" version" : " 1.0.0" ,
@@ -301,10 +362,13 @@ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/e
301
362
]
302
363
` ` `
303
364
304
- ** --recursive**
365
+ # ## --recursive
366
+
367
+ ` ` ` bash
368
+ $ stac-validator https://spot-canada-ortho.s3.amazonaws.com/catalog.json --recursive --max-depth 1 --verbose
369
+ ` ` `
305
370
306
371
` ` ` bash
307
- stac-validator https://spot-canada-ortho.s3.amazonaws.com/catalog.json --recursive --max-depth 1 --verbose
308
372
[
309
373
{
310
374
" version" : " 0.8.1" ,
@@ -333,24 +397,28 @@ stac-validator https://spot-canada-ortho.s3.amazonaws.com/catalog.json --recursi
333
397
]
334
398
` ` `
335
399
336
- ** --item-collection**
400
+ # ## --item-collection
337
401
338
402
` ` ` bash
339
- stac-validator https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a/items --item-collection --pages 2
403
+ $ stac-validator https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a/items --item-collection --pages 2
340
404
` ` `
341
405
342
- ** --header**
406
+ # ## --header
343
407
344
408
` ` ` bash
345
- stac-validator https://stac-catalog.eu/collections/sentinel-s2-l2a/items --header x-api-key $MY_API_KEY --header foo bar
409
+ $ stac-validator https://stac-catalog.eu/collections/sentinel-s2-l2a/items --header x-api-key $MY_API_KEY --header foo bar
346
410
` ` `
347
411
348
- ** --schema-map**
412
+ # ## --schema-map
413
+
349
414
Schema map allows stac-validator to replace a schema in a STAC json by a schema from another URL or local schema file.
350
415
This is especially useful when developing a schema and testing validation against your local copy of the schema.
351
416
352
- ` ` ` bash
353
- stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --extensions --schema-map https://stac-extensions.github.io/projection/v1.0.0/schema.json stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/v1.0.0/examples/extended-item.json --extensions --schema-map https://stac-extensions.github.io/projection/v1.0.0/schema.json " tests/test_data/schema/v1.0.0/projection.json"
417
+ ` ` ` bash
418
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/v1.0.0/examples/extended-item.json --extensions --schema-map https://stac-extensions.github.io/projection/v1.0.0/schema.json " tests/test_data/schema/v1.0.0/projection.json"
419
+ ` ` `
420
+
421
+ ` ` ` bash
354
422
[
355
423
{
356
424
" version" : " 1.0.0" ,
@@ -372,7 +440,10 @@ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/e
372
440
This option is also capable of replacing URLs to subschemas:
373
441
374
442
` ` ` bash
375
- stac-validator tests/test_data/v100/extended-item-local.json --custom tests/test_data/schema/v1.0.0/item_with_unreachable_url.json --schema-map https://geojson-wrong-url.org/schema/Feature.json https://geojson.org/schema/Feature.json --schema-map https://geojson-wrong-url.org/schema/Geometry.json https://geojson.org/schema/Geometry.json
443
+ $ stac-validator tests/test_data/v100/extended-item-local.json --custom tests/test_data/schema/v1.0.0/item_with_unreachable_url.json --schema-map https://geojson-wrong-url.org/schema/Feature.json https://geojson.org/schema/Feature.json --schema-map https://geojson-wrong-url.org/schema/Geometry.json https://geojson.org/schema/Geometry.json
444
+ ` ` `
445
+
446
+ ` ` ` bash
376
447
[
377
448
{
378
449
" version" : " 1.0.0" ,
@@ -387,4 +458,19 @@ stac-validator tests/test_data/v100/extended-item-local.json --custom tests/test
387
458
]
388
459
` ` `
389
460
461
+ # # Sponsors and Supporters
462
+
463
+ The following organizations have contributed time and/or funding to support the development of this project:
464
+
465
+ < p align=" left" >
466
+ < a href=" https://healy-hyperspatial.github.io/" ><img src=" https://raw.githubusercontent.com/stac-utils/stac-fastapi-elasticsearch-opensearch/refs/heads/main/assets/hh-logo-blue.png" alt=" Healy Hyperspatial" height=" 100" hspace=" 20" ></a>
467
+ < /p>
468
+
469
+
470
+ # # Contributing
471
+
472
+ Contributions are welcome! Please feel free to submit a Pull Request.
473
+
474
+ # # License
390
475
476
+ This project is licensed under the Apache License 2.0.
0 commit comments