GIScience / ohsome-api

API for analysing OpenStreetMap history data
https://api.ohsome.org
GNU Affero General Public License v3.0
47 stars 8 forks source link

Inconsistent CSV output #276

Open mcauer opened 2 years ago

mcauer commented 2 years ago

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.

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.

joker234 commented 2 years ago

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.