geosolutions-it/nexus-geonode

Datasets from remote services are reported as "unknown type"

Closed this issue · 1 comments

@giohappy
cc @afabiani

The behavior mentioned in this issue has been fixed, and therefore this issue can be closed.

However, support for remote resources in the QGIS plugin is currently not really working due to, IMO, some GeoNode bugs.

The current version of the plugin only loads datasets whose subtype property is either vector or raster. It does not really distinguish if datasets are local or remote for now (although we could implement something like that by looking at the API response's sourcetype field, which shows a value of REMOTE for remote resources).

Regardless of the dataset origin, if the API response includes a links list with each object having keys with link_type: "OGC:WMS", link_type: "OGC_WFS" or link_type: "OGC_WCS" then the plugin will offer buttons for loading the dataset onto QGIS map canvas.

However, from a brief investigation, it seems there are two different implementations of remote resources in GeoNode at the moment. When querying master.demo.geonode.org for a list of remote datasets, like this:

https://master.demo.geonode.org/api/v2/datasets/?filter{sourcetype}=REMOTE

The returned datasets have subtype=remote. To me this seems like a bug in GeoNode, as the same datasets already have sourcetype=REMOTE, and also I assume the subtype property is meant for specifying the subtype of a dataset, not its origin. Therefore, as mentioned above, these resources are not recognized by the plugin and thus do not show up on search results. Presumably, these datasets have been generated with GeoNode's remote services feature.

The other implementation would be the one where datasets come straight from the geonode.harvesting module. I'm not sure, but I am assuming that master.demo.geonode.org does not have any such datasets at the moment. The NEXUS staging environment also does not seem to contain any remote datasets at the moment, as issuing this request

https://dev.nexus.geosolutionsgroup.com/api/v2/datasets/?filter{sourcetype}=REMOTE

returns a total of 0 results.

On my own local dev instance, which is up to date with the NEXUS repo master branch, I have remote resources which were generated by using a harvester. When issuing a request like:

http://localhost/api/v2/datasets/?filter{sourcetype}=REMOTE

The resulting datasets do have subtype=vector. This means that datasets coming straight from the harvesting module do not suffer from the aforementioned bug. This means the QGIS plugin is able to recognize them and show them on the datasets list. Unfortunately, the API response does not include any links.link property with a suitable link_type, which means that the QGIS plugin is not able to offer to load them as layers in QGIS, since it does not know how to get them. To me this seems like a different bug in GeoNode, whereby the links property of the API response is incomplete.

Note that, when requesting a dataset's detail page, with a request such as

http://localhost/api/v2/datasets/{datasetId}/

the returned dataset does have a ows_url property, which can be used to construct the relevant OWS requests. This means that GeoNode does have enough information to build a correct links property on the dataset list endpoint.

In conclusion, it seems to me that remote resources should now be working OK on the QGIS plugin but they are currently broken due to some inconsistencies in the GeoNode API.