- Notifications
You must be signed in to change notification settings - Fork 44
Closed
Description
Description
When trying to submit a POST /collections/{collection_id}/items request the following behaviors occur:
- if the
geometryfield is missing, I get a400response associated to aRequestValidationErrorstating that thegeometryfield is required; - if the
geometryfield is null, I get a424response associated to aDatabaseError, which appears to be caused by the fact that thegeometrycolumn in the postgres datbase is not nullable;
Expected behavior
The STAC Item specification for the geometry field states that
If a geometry is provided, the value must be a Geometry Object according to RFC 7946, section 3.1 with the exception that the type GeometryCollection is not allowed in STAC. If no geometry is provided, the value must be null according to RFC 7946, section 3.2.
I would thus expect it to be possible to at least create an Item with the geometry property set to null.
How to replicate
After cloning the repository, in its root directory launch
docker compose -f docker-compose.yml up Then
curl -X 'POST' \ 'http://0.0.0.0:8082/collections/joplin/items' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "id": "f2cca2a3-288b-4518-8a3e-a4492bb60b08", "type": "Feature", "collection": "joplin", "links": [], "properties": { "datetime": "2000-02-02T00:00:00Z" }, "assets": {}, "stac_extensions": [], "stac_version": "1.0.0" }' which results in
{"code":"RequestValidationError","description":"[{'type': 'missing', 'loc': ('body', 'Item', 'geometry'), 'msg': 'Field required', 'input': {'id': 'f2cca2a3-288b-4518-8a3e-a4492bb60b08', 'type': 'Feature', 'collection': 'joplin', 'links': [], 'properties': {'datetime': '2000-02-02T00:00:00Z'}, 'assets': {}, 'stac_extensions': [], 'stac_version': '1.0.0'}}, {'type': 'literal_error', 'loc': ('body', 'ItemCollection', 'type'), 'msg': \"Input should be 'FeatureCollection'\", 'input': 'Feature', 'ctx': {'expected': \"'FeatureCollection'\"}}, {'type': 'missing', 'loc': ('body', 'ItemCollection', 'features'), 'msg': 'Field required', 'input': {'id': 'f2cca2a3-288b-4518-8a3e-a4492bb60b08', 'type': 'Feature', 'collection': 'joplin', 'links': [], 'properties': {'datetime': '2000-02-02T00:00:00Z'}, 'assets': {}, 'stac_extensions': [], 'stac_version': '1.0.0'}}]"} Also, try
curl -X 'POST' \ 'http://0.0.0.0:8082/collections/joplin/items' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "id": "f2cca2a3-288b-4518-8a3e-a4492bb60b08", "type": "Feature", "geometry": null, "collection": "joplin", "links": [], "properties": { "datetime": "2000-02-02T00:00:00Z" }, "assets": {}, "stac_extensions": [], "stac_version": "1.0.0" }' which results in
{ "code": "DatabaseError", "description": "" } vprivat-ads
Metadata
Metadata
Assignees
Labels
No labels