Skip to content

Using the emod2018 dataset, opentopodata.org's API returns invalid JSON #13

@l3u

Description

@l3u

Hi :-)

Whilst working on a geotagging program using opentopodata.org's API, I noticed some error when parsing the server's answer to a QJsonDocument. It yielded QJsonParseError::IllegalNumber. After having had a closer look, this happened when using the emod2018 dataset.

Example: Requesting https://api.opentopodata.org/v1/emod2018?locations=50,11 returns

{
"results": [
    {
    "elevation": NaN, 
    "location": {
        "lat": 50.0, 
        "lng": 11.0
    }
    }
], 
"status": "OK"
}

The elevation key's value is NaN (instead of null, as the other datasets return when a coordinate is out of bounds). This is, per RFC 4627, not permitted (cf. https://tools.ietf.org/html/rfc4627#section-2.4):

Numeric values that cannot be represented as sequences of digits
(such as Infinity and NaN) are not permitted.

Most probably, this is what QJsonDocument::fromJson complains about.

Anyway, thanks about this great piece of software and the great service you provide :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions