Skip to content

Implement fields extension #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@

- [ ] Code is formatted and linted (run `pre-commit run --all-files`)
- [ ] Tests pass (run `make test`)
- [ ] Documentation has been updated to reflect changes, if applicable, and docs build successfully (run `make docs`)
- [ ] Documentation has been updated to reflect changes, if applicable
- [ ] Changes are added to the changelog
13 changes: 7 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Added

- Added bbox and datetime parameters and functionality to item_collection https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127
- Added collection_id parameter to create_item function https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127
- Added item_id and collection_id to update_item https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127
- The default Collection objects index can be overridden by the `STAC_COLLECTIONS_INDEX` environment variable.
- The default Item objects index prefix can be overridden by the `STAC_ITEMS_INDEX_PREFIX` environment variable.
- Added bbox and datetime parameters and functionality to item_collection [#127](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127)
- Added collection_id parameter to create_item function [#127](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127)
- Added item_id and collection_id to update_item [#127](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/127)
- 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)
- 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)
- Fields Extension [#129](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/129)


### Changed

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

## [v0.2.0]

Expand Down
10 changes: 0 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,6 @@ pybase-install:
install: pybase-install
pip install -e ./stac_fastapi/elasticsearch[dev,server]

.PHONY: docs-image
docs-image:
docker-compose -f docker-compose.docs.yml \
build

.PHONY: docs
docs: docs-image
docker-compose -f docker-compose.docs.yml \
run docs

.PHONY: ingest
ingest:
python3 data_loader/data_loader.py
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# STAC FastAPI Elasticsearch

Elasticsearch backend for stac-fastapi.
## Elasticsearch backend for stac-fastapi

### Join our [Gitter](https://gitter.im/stac-fastapi-elasticsearch/community) page

Join our [Gitter](https://gitter.im/stac-fastapi-elasticsearch/community) page
### Check out the public Postman documentation [Postman](https://documenter.getpostman.com/view/12888943/2s8ZDSdRHA)

### For changes, see the [Changelog](CHANGELOG.md)

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

## Development Environment Setup

Expand All @@ -30,7 +33,7 @@ pre-commit run --all-files
```shell
docker-compose build
```

## Running API on localhost:8080

```shell
Expand All @@ -55,14 +58,15 @@ curl -X "POST" "http://localhost:8080/collections" \
}'
```

Note: this "Collections Transaction" behavior is not part of the STAC API, but may be soon.
Note: this "Collections Transaction" behavior is not part of the STAC API, but may be soon.


## Testing

```shell
make test
```

## Ingest sample data

```shell
Expand All @@ -71,7 +75,8 @@ make ingest

## Elasticsearch Mappings

Mappings apply to search index, not source.
Mappings apply to search index, not source.


## Managing Elasticsearch Indices

Expand Down
170 changes: 155 additions & 15 deletions postman_collections/stac-fastapi-elasticsearch.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"info": {
"_postman_id": "ca9d0979-4035-45ad-bfba-582a680a05ab",
"name": "stac-fastapi-elasticsearch",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "12888943"
},
"item": [
{
Expand All @@ -16,7 +17,7 @@
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
""
]
Expand All @@ -35,7 +36,7 @@
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
"collections"
]
Expand All @@ -54,7 +55,7 @@
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
"collections",
"test-collection"
Expand All @@ -74,7 +75,7 @@
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
"collections",
"test-collection",
Expand All @@ -96,7 +97,7 @@
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
"collections",
"test-collection"
Expand All @@ -116,7 +117,7 @@
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
"collections",
"test-collection",
Expand All @@ -137,7 +138,7 @@
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
"collections",
"test-collection",
Expand Down Expand Up @@ -174,7 +175,7 @@
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
"collections"
]
Expand Down Expand Up @@ -208,7 +209,7 @@
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
"collections",
"test-collection",
Expand All @@ -218,6 +219,43 @@
},
"response": []
},
{
"name": "UPDATE item",
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-type": true
}
},
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "default"
}
],
"body": {
"mode": "raw",
"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}"
},
"url": {
"raw": "http://localhost:8080/collections/test-collection/items/test-item",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"collections",
"test-collection",
"items",
"test-item"
]
}
},
"response": []
},
{
"name": "POST search <point intersection>",
"protocolProfileBehavior": {
Expand All @@ -236,15 +274,49 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"collections\":[\"test-collection\"],\n \"intersects\":{\"type\": \"Point\", \"coordinates\": [150.04, -33.14]}\n}"
"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}"
},
"url": {
"raw": "http://localhost:8080/search",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"search"
]
}
},
"response": []
},
{
"name": "POST search <polygon intersection>",
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-type": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "default"
}
],
"body": {
"mode": "raw",
"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}"
},
"url": {
"raw": "http://localhost:8080/search",
"protocol": "http",
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
"search"
]
Expand All @@ -270,15 +342,83 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"collections\":[\"sentinel-s2-l2a\"],\n \"bbox\": [-69.433594,-10.660608,-47.285156,3.513421]\n}"
"raw": "{\n \"bbox\": [97.504892,-45.254738,174.321298,-2.431580]\n}"
},
"url": {
"raw": "http://localhost:8080/search",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"search"
]
}
},
"response": []
},
{
"name": "POST search <bbox> Fields Include",
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-type": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "default"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"bbox\": [97.504892,-45.254738,174.321298,-2.431580],\n \"fields\": {\n \"include\": [\"properties.gsd\"]\n }\n}"
},
"url": {
"raw": "http://localhost:8080/search",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"search"
]
}
},
"response": []
},
{
"name": "POST search <bbox> Fields Exclude",
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-type": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "default"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"bbox\": [97.504892,-45.254738,174.321298,-2.431580],\n \"fields\": {\n \"exclude\": [\"properties\"]\n }\n}"
},
"url": {
"raw": "http://localhost:8080/search",
"protocol": "http",
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
"search"
]
Expand All @@ -303,7 +443,7 @@
"host": [
"localhost"
],
"port": "8083",
"port": "8080",
"path": [
"search"
],
Expand Down
Loading