Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'ERROR - missing coords parameter' despite coords parameter provided #859

Closed
kevpax-24 opened this issue Feb 25, 2022 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@kevpax-24
Copy link

kevpax-24 commented Feb 25, 2022

Description
My request to the position endpoint of my xarray-edr collection is not returning anything (just seems to refresh the page), and also results in the log recording an error of missing coords parameter.

Steps to Reproduce
My request:
http://localhost:5001/collections/dbossh/position?coords=POINT(0%200)

Note: adding '&f=json' causes it to work correctly. As far as I'm aware this should not be required, as it should default to json.

My config, and dump of the netCDF source:
dassh-config.txt
ncdump_out.txt

Expected behavior
A json of a subset of my dataset is returned (empty in this case, since there are no data points at POINT(0,0))

Screenshots/Tracebacks
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/l10n.py:357} DEBUG - Got locale 'en-GB,en-US;q=0.9,en;q=0.8' from 'Accept-Language' header
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/l10n.py:227} DEBUG - 'en_US' matches requested 'en-GB,en-US;q=0.9,en;q=0.8'
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/l10n.py:411} DEBUG - Setting Content-Language to en-US
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/api.py:2942} DEBUG - Processing query parameters
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/api.py:2944} DEBUG - Processing datetime parameter
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/api.py:2954} DEBUG - Processing parameter-name parameter
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/api.py:2959} DEBUG - Processing coords parameter
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/api.py:2974} DEBUG - Processing z parameter
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/api.py:2977} DEBUG - Loading provider
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/util.py:447} DEBUG - Searching for provider type edr
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/plugin.py:88} DEBUG - Plugins: {'CSV': 'pygeoapi.provider.csv_.CSVProvider', 'Elasticsearch': 'pygeoapi.provider.elasticsearch_.ElasticsearchProvider', 'ElasticsearchCatalogue': 'pygeoapi.provider.elasticsearch_.ElasticsearchCatalogueProvider', 'GeoJSON': 'pygeoapi.provider.geojson.GeoJSONProvider', 'OGR': 'pygeoapi.provider.ogr.OGRProvider', 'PostgreSQL': 'pygeoapi.provider.postgresql.PostgreSQLProvider', 'SQLiteGPKG': 'pygeoapi.provider.sqlite.SQLiteGPKGProvider', 'MongoDB': 'pygeoapi.provider.mongo.MongoProvider', 'FileSystem': 'pygeoapi.provider.filesystem.FileSystemProvider', 'rasterio': 'pygeoapi.provider.rasterio_.RasterioProvider', 'xarray': 'pygeoapi.provider.xarray_.XarrayProvider', 'MVT': 'pygeoapi.provider.mvt.MVTProvider', 'TinyDBCatalogue': 'pygeoapi.provider.tinydb_.TinyDBCatalogueProvider', 'SensorThings': 'pygeoapi.provider.sensorthings.SensorThingsProvider', 'xarray-edr': 'pygeoapi.provider.xarray_edr.XarrayEDRProvider'}
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/plugin.py:100} DEBUG - package name: pygeoapi.provider.xarray_edr
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/plugin.py:101} DEBUG - class name: XarrayEDRProvider
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/provider/xarray_edr.py:80} DEBUG - Query parameters: {'query_type': 'position', 'instance': None, 'format_': 'html', 'datetime_': None, 'select_properties': [], 'wkt': <shapely.geometry.point.Point object at 0x7fba6180c880>, 'z': None}
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/provider/xarray_edr.py:82} DEBUG - Query type: position
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/provider/xarray_edr.py:86} DEBUG - Processing WKT
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/provider/xarray_edr.py:87} DEBUG - Geometry type: Point
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/provider/xarray_edr.py:99} DEBUG - Processing parameter-name
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/provider/xarray_edr.py:105} DEBUG - instance: None
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/provider/xarray_edr.py:111} DEBUG - query parameters: {'latitude': 0.0, 'longitude': 0.0}
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/provider/xarray_.py:315} DEBUG - Creating CoverageJSON domain
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/util.py:334} DEBUG - using default templates: /home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/templates
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/werkzeug/_internal.py:225} INFO - 192.171.193.10 - - [25/Feb/2022 16:45:36] "GET /collections/dbossh/position?coords=POINT(0%200)f=json HTTP/1.1" 200 -
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/werkzeug/_internal.py:225} INFO - 192.171.193.10 - - [25/Feb/2022 16:45:36] "GET /static/css/default.css HTTP/1.1" 304 -
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/werkzeug/_internal.py:225} INFO - 192.171.193.10 - - [25/Feb/2022 16:45:36] "GET /static/img/logo.png HTTP/1.1" 304 -
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/l10n.py:357} DEBUG - Got locale 'en-GB,en-US;q=0.9,en;q=0.8' from 'Accept-Language' header
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/l10n.py:227} DEBUG - 'en_US' matches requested 'en-GB,en-US;q=0.9,en;q=0.8'
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/l10n.py:411} DEBUG - Setting Content-Language to en-US
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/api.py:2942} DEBUG - Processing query parameters
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/api.py:2944} DEBUG - Processing datetime parameter
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/api.py:2954} DEBUG - Processing parameter-name parameter
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/api.py:2959} DEBUG - Processing coords parameter
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/pygeoapi-0.12.dev0-py3.8.egg/pygeoapi/api.py:3202} ERROR - missing coords parameter
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/werkzeug/_internal.py:225} INFO - 192.171.193.10 - - [25/Feb/2022 16:45:36] "GET /collections/dbossh/position?f=jsonld HTTP/1.1" 400 -
[2022-02-25T16:45:36Z] {/home/root/pygeoapi/lib/python3.8/site-packages/werkzeug/_internal.py:225} INFO - 192.171.193.10 - - [25/Feb/2022 16:45:36] "GET /static/img/pygeoapi.png HTTP/1.1" 304 -
[2022-02-25T16:45:37Z] {/home/root/pygeoapi/lib/python3.8/site-packages/werkzeug/_internal.py:225} INFO - 192.171.193.10 - - [25/Feb/2022 16:45:37] "GET /static/img/favicon.ico HTTP/1.1" 304 -

It appears to complete correctly but then immediately initiates a new GET with the coords parameter now empty.

Environment

  • OS:
  • Python version:
    3.8.10
  • pygeoapi version:
    0.12.dev0
@kevpax-24 kevpax-24 added the bug Something isn't working label Feb 25, 2022
@tomkralidis
Copy link
Member

Sorry I cannot reproduce/worksforme. I notice that the request is missing the & before the f=json. Can you try with:

http://localhost:5001/collections/dbossh/position?coords=POINT(0 0)&f=json

@kevpax-24
Copy link
Author

Well... I feel stupid... shouldn't file bug reports last thing on a Friday.

@kevpax-24 kevpax-24 reopened this Mar 9, 2022
@kevpax-24
Copy link
Author

Re-opened as discovered that although this works:
http://localhost:5001/collections/dbossh/position?coords=POINT(0%200)&f=json

This does not work:
http://localhost:5001/collections/dbossh/position?coords=POINT(0%200)
(same behaviour as described in initial report)

I've updated Issue description to reflect this.

@tomkralidis
Copy link
Member

Sorry I still cannot reproduce (no ERROR).

@justb4
Copy link
Member

justb4 commented Mar 9, 2022

I can only comment on this:

 Note: adding '&f=json' causes it to work correctly. As far as I'm aware this should not be required, as it should default to json.

The default is GeoJSON if no format "is proposed". When you open that URL in a browser (which I assume here) , the browser will propose HTML format via the Accept HTTP header (unless you overrule with f=json). Try opening the URL with e.g. curl or a REST client.

@kevpax-24
Copy link
Author

Thanks @justb4 - can confirm it works with curl, so it is a browser issue.

I still think it should not be behaving in this way i.e. claiming 'ERROR - missing coords parameter'.

I found the following error in Chrome's console, something appears to be getting mangled at some point:

Uncaught SyntaxError: Unexpected token & in JSON at position 1
    at JSON.parse (<anonymous>)
    at http://localhost:5001/collections/dbossh/position?coords=POINT(:5001/collections/dbossh/0%200):91:23

Failed to load resource: the server responded with a status of 400 (BAD REQUEST)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants