Skip to content

FDSNWS: Bug in query with radial geographic constraint (internal server error: "distance returned negative!") #109

@megies

Description

@megies

Using a radial geographic constraint can somehow end up in negative distances being calculated internally during assembling the QuerySet, which leads to an exception being raised and the server not returning any results but rather giving a HTTP 500 "Internal server error".

Works without radial constraint:

$ wget -O - 'https://erde.geophysik.uni-muenchen.de/fdsnws/event/1/query?format=text&minmagnitude=1.0&maxmagnitude=1.0001&starttime=2002-09-29T23:31:27&endtime=2002-09-29T23:31:33'
--2020-11-02 13:59:59--  https://erde.geophysik.uni-muenchen.de/fdsnws/event/1/query?format=text&minmagnitude=1.0&maxmagnitude=1.0001&starttime=2002-09-29T23:31:27&endtime=2002-09-29T23:31:33
Resolving erde.geophysik.uni-muenchen.de (erde.geophysik.uni-muenchen.de)... 141.84.11.2
Connecting to erde.geophysik.uni-muenchen.de (erde.geophysik.uni-muenchen.de)|141.84.11.2|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text]
Saving to: ‘STDOUT’

-                                    [<=>                                                      ]       0  --.-KB/s               #EventID|Time|Latitude|Longitude|Depth/km|Author|Catalog|Contributor|ContributorID|MagType|Magnitude|MagAuthor|EventLocationName
smi:de.erdbeben-in-bayern/event/20020929233127|2002-09-29T23:31:27.750000Z|47.754833|12.768|-0.8|toni||||Ml|1.0||AUSTRIA
-                                    [ <=>                                                     ]     252  --.-KB/s    in 0s      

2020-11-02 13:59:59 (74.2 MB/s) - written to stdout [252]

Same query with an added radial constraint on top:

$ wget -O - 'https://erde.geophysik.uni-muenchen.de/fdsnws/event/1/query?format=text&minmagnitude=1.0&maxmagnitude=1.0001&starttime=2002-09-29T23:31:27&endtime=2002-09-29T23:31:33&latitude=48&longitude=12&maxradius=0.01'
--2020-11-02 14:08:13--  https://erde.geophysik.uni-muenchen.de/fdsnws/event/1/query?format=text&minmagnitude=1.0&maxmagnitude=1.0001&starttime=2002-09-29T23:31:27&endtime=2002-09-29T23:31:33&latitude=48&longitude=12&maxradius=0.01
Resolving erde.geophysik.uni-muenchen.de (erde.geophysik.uni-muenchen.de)... 141.84.11.2
Connecting to erde.geophysik.uni-muenchen.de (erde.geophysik.uni-muenchen.de)|141.84.11.2|:443... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2020-11-02 14:08:13 ERROR 500: Internal Server Error.

In the browser it shows "Exception Value: | distance returned negative!"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions