GIScience / ohsome-quality-api

Data quality estimations for OpenStreetMap
https://api.quality.ohsome.org
GNU Affero General Public License v3.0
35 stars 7 forks source link

Mapping Saturation and Currentness Request Fail with Validation Error #831

Closed hn437 closed 1 month ago

hn437 commented 1 month ago

Requesting a local setup of OQAPI in Version 1.5 fails with 422 Error: Unprocessable Entity. Tested for mapping saturation and currentness with standard settings. Requests as following:

curl -X 'POST' \
  'http://127.0.0.1:8080/indicators/mapping-saturation' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "bpolys": {
    "type": "FeatureCollection",
    "features": [
      {
        "geometry": {
          "coordinates": [
            [
              [
                8.674092292785645,
                49.40427147224242
              ],
              [
                8.695850372314453,
                49.40427147224242
              ],
              [
                8.695850372314453,
                49.415552187316095
              ],
              [
                8.674092292785645,
                49.415552187316095
              ],
              [
                8.674092292785645,
                49.40427147224242
              ]
            ]
          ],
          "type": "Polygon"
        },
        "type": "Feature"
      }
    ]
  },
  "topic": "building-count",
  "includeFigure": true
}'

Return Body:

{
  "apiVersion": "1.5.0",
  "type": "RequestValidationError",
  "detail": [
    {
      "type": "missing",
      "loc": [
        "body",
        "bpolys",
        "features",
        0,
        "properties"
      ],
      "msg": "Field required",
      "input": {
        "geometry": {
          "coordinates": [
            [
              [
                8.674092292785645,
                49.40427147224242
              ],
              [
                8.695850372314453,
                49.40427147224242
              ],
              [
                8.695850372314453,
                49.415552187316095
              ],
              [
                8.674092292785645,
                49.415552187316095
              ],
              [
                8.674092292785645,
                49.40427147224242
              ]
            ]
          ],
          "type": "Polygon"
        },
        "type": "Feature"
      },
      "url": "https://errors.pydantic.dev/2.8/v/missing"
    }
  ]
}
mcauer commented 1 month ago

Laut GeoJSON RFC Standard muss jedes Feature ein "properties" Feld haben, das kann dann ein Object oder null sein, im Beispiel fehlt es aber komplett. Darüber beschwert sich die Validator Klasse mit "missing" "Required Field". Evlt. falsche Beispieldaten im Swagger?