Skip to content

Commit 0f75c89

Browse files
authored
Merge pull request #129 from stac-utils/implement-fields-extension
Implement fields extension
2 parents 80c246f + 7e0ca91 commit 0f75c89

File tree

11 files changed

+257
-121
lines changed

11 files changed

+257
-121
lines changed

.github/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99

1010
- [ ] Code is formatted and linted (run `pre-commit run --all-files`)
1111
- [ ] Tests pass (run `make test`)
12-
- [ ] Documentation has been updated to reflect changes, if applicable, and docs build successfully (run `make docs`)
12+
- [ ] Documentation has been updated to reflect changes, if applicable
1313
- [ ] Changes are added to the changelog

CHANGELOG.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99

1010
### Added
1111

12-
- Added bbox and datetime parameters and functionality to item_collection https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127
13-
- Added collection_id parameter to create_item function https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127
14-
- Added item_id and collection_id to update_item https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127
15-
- The default Collection objects index can be overridden by the `STAC_COLLECTIONS_INDEX` environment variable.
16-
- The default Item objects index prefix can be overridden by the `STAC_ITEMS_INDEX_PREFIX` environment variable.
12+
- Added bbox and datetime parameters and functionality to item_collection [#127](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127)
13+
- Added collection_id parameter to create_item function [#127](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127)
14+
- Added item_id and collection_id to update_item [#127](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127)
15+
- The default Collection objects index can be overridden by the `STAC_COLLECTIONS_INDEX` environment variable [#128](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/128)
16+
- The default Item objects index prefix can be overridden by the `STAC_ITEMS_INDEX_PREFIX` environment variable [#128](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/128)
17+
- Fields Extension [#129](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/129)
1718

1819

1920
### Changed
2021

21-
- Updated core stac-fastapi libraries to 2.4.3 from 2.3.0 https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127
22+
- Updated core stac-fastapi libraries to 2.4.3 from 2.3.0 [#127](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127)
2223

2324
## [v0.2.0]
2425

Makefile

-10
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,6 @@ pybase-install:
6060
install: pybase-install
6161
pip install -e ./stac_fastapi/elasticsearch[dev,server]
6262

63-
.PHONY: docs-image
64-
docs-image:
65-
docker-compose -f docker-compose.docs.yml \
66-
build
67-
68-
.PHONY: docs
69-
docs: docs-image
70-
docker-compose -f docker-compose.docs.yml \
71-
run docs
72-
7363
.PHONY: ingest
7464
ingest:
7565
python3 data_loader/data_loader.py

README.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# STAC FastAPI Elasticsearch
22

3-
Elasticsearch backend for stac-fastapi.
3+
## Elasticsearch backend for stac-fastapi
4+
5+
### Join our [Gitter](https://gitter.im/stac-fastapi-elasticsearch/community) page
46

5-
Join our [Gitter](https://gitter.im/stac-fastapi-elasticsearch/community) page
7+
### Check out the public Postman documentation [Postman](https://documenter.getpostman.com/view/12888943/2s8ZDSdRHA)
8+
9+
### For changes, see the [Changelog](CHANGELOG.md)
610

7-
For changes, see the [Changelog](CHANGELOG.md).
811

912
## Development Environment Setup
1013

@@ -30,7 +33,7 @@ pre-commit run --all-files
3033
```shell
3134
docker-compose build
3235
```
33-
36+
3437
## Running API on localhost:8080
3538

3639
```shell
@@ -55,14 +58,15 @@ curl -X "POST" "http://localhost:8080/collections" \
5558
}'
5659
```
5760

58-
Note: this "Collections Transaction" behavior is not part of the STAC API, but may be soon.
61+
Note: this "Collections Transaction" behavior is not part of the STAC API, but may be soon.
62+
5963

6064
## Testing
6165

6266
```shell
6367
make test
6468
```
65-
69+
6670
## Ingest sample data
6771

6872
```shell
@@ -71,7 +75,8 @@ make ingest
7175

7276
## Elasticsearch Mappings
7377

74-
Mappings apply to search index, not source.
78+
Mappings apply to search index, not source.
79+
7580

7681
## Managing Elasticsearch Indices
7782

postman_collections/stac-fastapi-elasticsearch.postman_collection.json

+155-15
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"info": {
33
"_postman_id": "ca9d0979-4035-45ad-bfba-582a680a05ab",
44
"name": "stac-fastapi-elasticsearch",
5-
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
5+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
6+
"_exporter_id": "12888943"
67
},
78
"item": [
89
{
@@ -16,7 +17,7 @@
1617
"host": [
1718
"localhost"
1819
],
19-
"port": "8083",
20+
"port": "8080",
2021
"path": [
2122
""
2223
]
@@ -35,7 +36,7 @@
3536
"host": [
3637
"localhost"
3738
],
38-
"port": "8083",
39+
"port": "8080",
3940
"path": [
4041
"collections"
4142
]
@@ -54,7 +55,7 @@
5455
"host": [
5556
"localhost"
5657
],
57-
"port": "8083",
58+
"port": "8080",
5859
"path": [
5960
"collections",
6061
"test-collection"
@@ -74,7 +75,7 @@
7475
"host": [
7576
"localhost"
7677
],
77-
"port": "8083",
78+
"port": "8080",
7879
"path": [
7980
"collections",
8081
"test-collection",
@@ -96,7 +97,7 @@
9697
"host": [
9798
"localhost"
9899
],
99-
"port": "8083",
100+
"port": "8080",
100101
"path": [
101102
"collections",
102103
"test-collection"
@@ -116,7 +117,7 @@
116117
"host": [
117118
"localhost"
118119
],
119-
"port": "8083",
120+
"port": "8080",
120121
"path": [
121122
"collections",
122123
"test-collection",
@@ -137,7 +138,7 @@
137138
"host": [
138139
"localhost"
139140
],
140-
"port": "8083",
141+
"port": "8080",
141142
"path": [
142143
"collections",
143144
"test-collection",
@@ -174,7 +175,7 @@
174175
"host": [
175176
"localhost"
176177
],
177-
"port": "8083",
178+
"port": "8080",
178179
"path": [
179180
"collections"
180181
]
@@ -208,7 +209,7 @@
208209
"host": [
209210
"localhost"
210211
],
211-
"port": "8083",
212+
"port": "8080",
212213
"path": [
213214
"collections",
214215
"test-collection",
@@ -218,6 +219,43 @@
218219
},
219220
"response": []
220221
},
222+
{
223+
"name": "UPDATE item",
224+
"protocolProfileBehavior": {
225+
"disabledSystemHeaders": {
226+
"content-type": true
227+
}
228+
},
229+
"request": {
230+
"method": "PUT",
231+
"header": [
232+
{
233+
"key": "Content-Type",
234+
"value": "application/json",
235+
"type": "default"
236+
}
237+
],
238+
"body": {
239+
"mode": "raw",
240+
"raw": "{\n \"type\": \"Feature\",\n \"id\": \"test-item\",\n \"stac_version\": \"1.0.1\",\n \"stac_extensions\": [\n \"https://stac-extensions.github.io/eo/v1.0.0/schema.json\",\n \"https://stac-extensions.github.io/projection/v1.0.0/schema.json\"\n ],\n \"geometry\": {\n \"coordinates\": [\n [\n [\n 152.15052873427666,\n -33.82243006904891\n ],\n [\n 150.1000346138806,\n -34.257132625788756\n ],\n [\n 149.5776607193635,\n -32.514709769700254\n ],\n [\n 151.6262528041627,\n -32.08081674221862\n ],\n [\n 152.15052873427666,\n -33.82243006904891\n ]\n ]\n ],\n \"type\": \"Polygon\"\n },\n \"properties\": {\n \"datetime\": \"2018-02-12T12:30:22Z\",\n \"landsat:scene_id\": \"LC82081612020043LGN00\",\n \"landsat:row\": \"161\",\n \"gsd\": 15,\n \"landsat:revision\": \"00\",\n \"view:sun_azimuth\": -148.83296771,\n \"instrument\": \"OLI_TIRS\",\n \"landsat:product_id\": \"LC08_L1GT_208161_20200212_20200212_01_RT\",\n \"eo:cloud_cover\": 0,\n \"landsat:tier\": \"RT\",\n \"landsat:processing_level\": \"L1GT\",\n \"landsat:column\": \"208\",\n \"platform\": \"landsat-8\",\n \"proj:epsg\": 32756,\n \"view:sun_elevation\": -37.30791534,\n \"view:off_nadir\": 0,\n \"height\": 2500,\n \"width\": 2500\n },\n \"bbox\": [\n 149.57574,\n -34.25796,\n 152.15194,\n -32.07915\n ],\n \"collection\": \"test-collection\",\n \"assets\": {},\n \"links\": [\n {\n \"href\": \"http://localhost:8081/collections/landsat-8-l1/items/LC82081612020043\",\n \"rel\": \"self\",\n \"type\": \"application/geo+json\"\n },\n {\n \"href\": \"http://localhost:8081/collections/landsat-8-l1\",\n \"rel\": \"parent\",\n \"type\": \"application/json\"\n },\n {\n \"href\": \"http://localhost:8081/collections/landsat-8-l1\",\n \"rel\": \"collection\",\n \"type\": \"application/json\"\n },\n {\n \"href\": \"http://localhost:8081/\",\n \"rel\": \"root\",\n \"type\": \"application/json\"\n }\n ]\n}"
241+
},
242+
"url": {
243+
"raw": "http://localhost:8080/collections/test-collection/items/test-item",
244+
"protocol": "http",
245+
"host": [
246+
"localhost"
247+
],
248+
"port": "8080",
249+
"path": [
250+
"collections",
251+
"test-collection",
252+
"items",
253+
"test-item"
254+
]
255+
}
256+
},
257+
"response": []
258+
},
221259
{
222260
"name": "POST search <point intersection>",
223261
"protocolProfileBehavior": {
@@ -236,15 +274,49 @@
236274
],
237275
"body": {
238276
"mode": "raw",
239-
"raw": "{\n \"collections\":[\"test-collection\"],\n \"intersects\":{\"type\": \"Point\", \"coordinates\": [150.04, -33.14]}\n}"
277+
"raw": "{\n \"collections\":[\"test-collection\"],\n \"limit\": 2,\n \"intersects\":{\"type\": \"Point\", \"coordinates\": [150.04, -33.14]},\n \"query\": {\n \"gsd\":{\"gt\":10}\n }\n}"
278+
},
279+
"url": {
280+
"raw": "http://localhost:8080/search",
281+
"protocol": "http",
282+
"host": [
283+
"localhost"
284+
],
285+
"port": "8080",
286+
"path": [
287+
"search"
288+
]
289+
}
290+
},
291+
"response": []
292+
},
293+
{
294+
"name": "POST search <polygon intersection>",
295+
"protocolProfileBehavior": {
296+
"disabledSystemHeaders": {
297+
"content-type": true
298+
}
299+
},
300+
"request": {
301+
"method": "POST",
302+
"header": [
303+
{
304+
"key": "Content-Type",
305+
"value": "application/json",
306+
"type": "default"
307+
}
308+
],
309+
"body": {
310+
"mode": "raw",
311+
"raw": "{\n \"collections\":[\"test-collection\"],\n \"intersects\":{\n \"type\": \"Polygon\", \n \"coordinates\": [\n [\n [\n 98.0859375,\n -7.362466865535738\n ],\n [\n 95.2734375,\n -44.33956524809713\n ],\n [\n 188.4375,\n -50.28933925329178\n ],\n [\n 168.75,\n 10.487811882056695\n ],\n [\n 98.0859375,\n -7.362466865535738\n ]\n ]\n ]\n }\n}"
240312
},
241313
"url": {
242314
"raw": "http://localhost:8080/search",
243315
"protocol": "http",
244316
"host": [
245317
"localhost"
246318
],
247-
"port": "8083",
319+
"port": "8080",
248320
"path": [
249321
"search"
250322
]
@@ -270,15 +342,83 @@
270342
],
271343
"body": {
272344
"mode": "raw",
273-
"raw": "{\n \"collections\":[\"sentinel-s2-l2a\"],\n \"bbox\": [-69.433594,-10.660608,-47.285156,3.513421]\n}"
345+
"raw": "{\n \"bbox\": [97.504892,-45.254738,174.321298,-2.431580]\n}"
346+
},
347+
"url": {
348+
"raw": "http://localhost:8080/search",
349+
"protocol": "http",
350+
"host": [
351+
"localhost"
352+
],
353+
"port": "8080",
354+
"path": [
355+
"search"
356+
]
357+
}
358+
},
359+
"response": []
360+
},
361+
{
362+
"name": "POST search <bbox> Fields Include",
363+
"protocolProfileBehavior": {
364+
"disabledSystemHeaders": {
365+
"content-type": true
366+
}
367+
},
368+
"request": {
369+
"method": "POST",
370+
"header": [
371+
{
372+
"key": "Content-Type",
373+
"value": "application/json",
374+
"type": "default"
375+
}
376+
],
377+
"body": {
378+
"mode": "raw",
379+
"raw": "{\n \"bbox\": [97.504892,-45.254738,174.321298,-2.431580],\n \"fields\": {\n \"include\": [\"properties.gsd\"]\n }\n}"
380+
},
381+
"url": {
382+
"raw": "http://localhost:8080/search",
383+
"protocol": "http",
384+
"host": [
385+
"localhost"
386+
],
387+
"port": "8080",
388+
"path": [
389+
"search"
390+
]
391+
}
392+
},
393+
"response": []
394+
},
395+
{
396+
"name": "POST search <bbox> Fields Exclude",
397+
"protocolProfileBehavior": {
398+
"disabledSystemHeaders": {
399+
"content-type": true
400+
}
401+
},
402+
"request": {
403+
"method": "POST",
404+
"header": [
405+
{
406+
"key": "Content-Type",
407+
"value": "application/json",
408+
"type": "default"
409+
}
410+
],
411+
"body": {
412+
"mode": "raw",
413+
"raw": "{\n \"bbox\": [97.504892,-45.254738,174.321298,-2.431580],\n \"fields\": {\n \"exclude\": [\"properties\"]\n }\n}"
274414
},
275415
"url": {
276416
"raw": "http://localhost:8080/search",
277417
"protocol": "http",
278418
"host": [
279419
"localhost"
280420
],
281-
"port": "8083",
421+
"port": "8080",
282422
"path": [
283423
"search"
284424
]
@@ -303,7 +443,7 @@
303443
"host": [
304444
"localhost"
305445
],
306-
"port": "8083",
446+
"port": "8080",
307447
"path": [
308448
"search"
309449
],

0 commit comments

Comments
 (0)