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

GeoNode API requests require a stronger minor version parsing #28911

Closed
qgib opened this issue Jan 25, 2019 · 16 comments
Closed

GeoNode API requests require a stronger minor version parsing #28911

qgib opened this issue Jan 25, 2019 · 16 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers Easy fix

Comments

@qgib
Copy link
Contributor

qgib commented Jan 25, 2019

Author Name: Giovanni Allegri (@giohappy)
Original Redmine Issue: 21093
Affected QGIS version: 3.5(master)
Redmine category:data_provider/geonode
Assignee: Alexander Bruy


Currently QGIS parses GeoNode's version with a simple .toInt(): https://github.com/qgis/QGIS/blob/master/src/core/geocms/geonode/qgsgeonoderequest.cpp#L275
but GeoNode adds more informations to the minor version, for instance "rc" for a release candidate. This makes the parsing fail and thus layers are not fetched.

As an example look at the "geonode_version" field on the master demo instance: http://master.demo.geonode.org/api/layers/

Probably a simple regex would be fine to extract only the first numbers from the minor version part.


Related issue(s): #28958 (duplicates)
Redmine related issue(s): 21140


@qgib
Copy link
Contributor Author

qgib commented Jan 25, 2019

Author Name: Giovanni Allegri (@giohappy)


  • assigned_to_id was configured as Tim Sutton

@qgib
Copy link
Contributor Author

qgib commented Jan 25, 2019

Author Name: Giovanni Allegri (@giohappy)


  • priority_id was changed from Normal to High

@qgib
Copy link
Contributor Author

qgib commented Jan 25, 2019

Author Name: Giovanni Manghi (@gioman)


  • priority_id was changed from High to Normal

@qgib
Copy link
Contributor Author

qgib commented Jan 25, 2019

Author Name: Giovanni Allegri (@giohappy)


Giovanni,
if the priority is global ok, I agree there are issues more relevant then this.
I thought priority was scoped to the category the issue was assigned to. In that case it's high because the current GeoNode provider is unasable with the current release of GeoNode.

@qgib
Copy link
Contributor Author

qgib commented Jan 25, 2019

Author Name: Giovanni Manghi (@gioman)


Giovanni Allegri wrote:

Giovanni,
if the priority is global ok, I agree there are issues more relevant then this.
I thought priority was scoped to the category the issue was assigned to. In that case it's high because the current GeoNode provider is unasable with the current release of GeoNode.

The rationale we use is: "high" is for issues causing crashes or data corruption or that are regressions. Does this issue fit it?

@qgib
Copy link
Contributor Author

qgib commented Jan 25, 2019

Author Name: Giovanni Allegri (@giohappy)


ok then this is not the case. This bug simply makes the provider unusable.

@qgib
Copy link
Contributor Author

qgib commented Jan 28, 2019

Author Name: Robert Ward (Robert Ward)


This bug is a bit of a red herring, yes it is a problem however if the code is made to correctly parse the minor version then no GeoNode layers are returned because the wrong code is executed to parse the json response.

The following is what is returned from http://master.demo.geonode.org/api/layers/

{"geonode_version": "2.10rc4", "meta": {"limit": 1000, "next": null, "offset": 0, "previous": null, "total_count": 1}, "objects": [{"abstract": "No abstract provided", "alternate":
 "geonode:ukcs_coast", "bbox_x0": "-22.756981842778200", "bbox_x1": "11.999999997221800", "bbox_y0": "47.999999998915300", "bbox_y1": "64.000000008915300", "constraints_other": null,
 "csw_type": "dataset", "csw_wkt_geometry": "POLYGON((-22.7595163995 47.9987371688,-22.7595163995 63.9997273802,11.9989578796 63.9997273802,11.9989578796 47.9987371688,-22.7595163995 
47.9987371688))", "data_quality_statement": null, "date": "2019-01-28T02:39:50.810622", "date_type": "publication", "default_style": "/api/styles/1/", "detail_url": 
"/layers/geonode:ukcs_coast", "dirty_state": false, "edition": null, "geogig_link": null, "gtype": "MultiPolygon", "has_time": false, "id": 1, "is_approved": true, "is_published": true,
 "keywords": ["features", "ukcs_coast"], "language": "eng", "license": 1, "maintenance_frequency": null, "name": "ukcs_coast", "online": true, "owner__username": "ward_r", "owner_name": 
"ward_r", "popular_count": 0, "purpose": null, "rating": 0, "regions": ["Global"], "resource_uri": "/api/layers/1/", "restriction_code_type": null, "share_count": 0, "site_url": 
"http://master.demo.geonode.org/", "spatial_representation_type": null, "srid": "EPSG:4230", "store_type": "dataStore", "supplemental_information": "No information provided", 
"temporal_extent_end": null, "temporal_extent_start": null, "thumbnail_url": "http://master.demo.geonode.org/uploaded/thumbs/layer-46d3505a-22d8-11e9-922b-0242ac120006-thumb.png", 
"title": "ukcs_coast", "typename": "geonode:ukcs_coast", "uuid": "46d3505a-22d8-11e9-922b-0242ac120006"}]}

Based on a version number of 2.10 the code executed expects to see values for the key 'links' which is not present in the above response. If the code is forced to execute the other code block where the expected version is 2.6 then the layers are correctly parsed. I have a GeoNode 2.8 instance that follows the same pattern and so GeoNode layers never appear in QGIS as they should do.

I have a working patch that parses the GeoNode json response based on the contents rather than the version numbers. It appears the GeoNode documentation does not state what the responses format should be let alone how it has changed over the versions. If somebody could point me at a GeoNode instance to provide the alternative json response I can create a unit test and create a pull request to GeoNode functionality working again in QGIS.

@qgib
Copy link
Contributor Author

qgib commented Jan 28, 2019

Author Name: Giovanni Allegri (@giohappy)


The issue of missing links has been addressed recently (GeoNode/geonode@704b8d5) but master demo is not updated yet.
You can test it using our own dev deployment with the fix applied: http://dev.geonode.geo-solutions.it/api/layers/

@qgib
Copy link
Contributor Author

qgib commented Feb 1, 2019

Author Name: Alexander Bruy (@alexbruy)


@qgib
Copy link
Contributor Author

qgib commented Feb 6, 2019

Author Name: Alexander Bruy (@alexbruy)


PR #9117


  • status_id was changed from Open to In Progress
  • pull_request_patch_supplied was changed from 0 to 1
  • assigned_to_id was changed from Tim Sutton to Alexander Bruy

@qgib
Copy link
Contributor Author

qgib commented Feb 6, 2019

Author Name: Alexander Bruy (@alexbruy)


@qgib
Copy link
Contributor Author

qgib commented Feb 6, 2019

Author Name: Alexander Bruy (@alexbruy)


@qgib
Copy link
Contributor Author

qgib commented Feb 8, 2019

Author Name: Alexander Bruy (@alexbruy)


Applied in changeset 440f8d4.


  • status_id was changed from In Progress to Closed
  • done_ratio was changed from 0 to 100

@qgib qgib closed this as completed Feb 8, 2019
@qgib
Copy link
Contributor Author

qgib commented Feb 8, 2019

Author Name: Tim Sutton (Tim Sutton)


Alexander Bruy wrote:

Applied in changeset 440f8d4.

Thanks very much @alex Bruy!

@qgib
Copy link
Contributor Author

qgib commented Feb 8, 2019

Author Name: Giovanni Allegri (@giohappy)


Thanks also from me ;)

@qgib
Copy link
Contributor Author

qgib commented Feb 9, 2019

Author Name: Alexander Bruy (@alexbruy)


  • resolution was changed from to fixed/implemented

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers Easy fix labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers Easy fix
Projects
None yet
Development

No branches or pull requests

1 participant