ohsome-api icon indicating copy to clipboard operation
ohsome-api copied to clipboard

Inconsistent CSV output

Open mcauer opened this issue 3 years ago • 1 comments

Bug Description

The way the CSV output is configured differs between endpoints. Sometimes fields are quoted with double-quotes (/elements/count) and s.t. not (/elements/count/groupBy/boundary) E.g.:

elements/count/

curl -X GET "https://api.ohsome.org/v1/elements/count?bboxes=8.67%2C49.39%2C8.71%2C49.42&filter=type%3Away%20and%20natural%3D*&format=csv&time=2014-01-01%2F2017-01-01%2FP1Y" -H  "accept: application/json"

# Copyright URL: https://ohsome.org/copyrights
# Copyright Text: © OpenStreetMap contributors
# API Version: 1.6.3
timestamp;value
"2014-01-01T00:00:00Z";"42.0"
"2015-01-01T00:00:00Z";"42.0"
"2016-01-01T00:00:00Z";"43.0"
"2017-01-01T00:00:00Z";"43.0"

elements/count/groupBy/boundary

curl -X GET "https://api.ohsome.org/v1/elements/count/groupBy/boundary?bboxes=8.67%2C49.39%2C8.71%2C49.42&filter=type%3Away%20and%20natural%3D*&format=csv&time=2014-01-01%2F2017-01-01%2FP1Y" -H  "accept: application/json"

# Copyright URL: https://ohsome.org/copyrights
# Copyright Text: © OpenStreetMap contributors
# API Version: 1.6.3
timestamp;boundary1
2014-01-01T00:00:00Z;42.0
2015-01-01T00:00:00Z;42.0
2016-01-01T00:00:00Z;43.0
2017-01-01T00:00:00Z;43.0

General Information

Please include the following general information about the issue and list any additional steps needed to reproduce the bug.

  • Version of the ohsome API : v1.6.3
  • Which API instance was requested: https://api.ohsome.org/v1`
  • Affected endpoint(s) /elements/count and /elements/count/groupbBy/boundary may be more
  • URL of your request (and request body if applicable): see above
  • Used HTTP method [GET or POST]: see above
  • Utilized tool/library for the request [e.g. cURL, Postman, ohsome-py, etc.]: see above

Expected Behaviour

Expected is that all ohsomeAPI CSV output follows the same encoding

Further Information

Error Messages, Logs, Screenshots

If applicable, add printed error messages, log files or screenshots to help explain your problem.

Additional Information

Add any other further information about the problem here.

Notes

Please consider to upload a file if request parameters, responses, error messages or logs are too long or poorly displayed in your bug report.

mcauer avatar May 27 '22 08:05 mcauer

The issue seems to be that the grouping results are created differently than the regular results, see https://github.com/GIScience/ohsome-api/blob/44a7e046395c2ec4443bc76d74fab6babfe38c9f/src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java#L191-L197 vs. https://github.com/GIScience/ohsome-api/blob/44a7e046395c2ec4443bc76d74fab6babfe38c9f/src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java#L216-L225 and https://github.com/GIScience/ohsome-api/blob/3d0d93dae4614b63dab3e5b238cce044caf93bfc/src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java#L279-L306.

joker234 avatar May 27 '22 09:05 joker234