geonode
geonode copied to clipboard
Implement recalculation of Geoserver featuretype and coverage bbox and update of dataset bbox
In this moment we don't have any helper function to recalculate (Geoserver) + update (GeoNode) the bbox of a dataset. Only the second part is provided by the sync_instance_with_geoserver
with the updatebbox parameter set to True
.
In general the recalculation of the bbox is required when the underlying data changes. For example when a vector dataset is edited from a client (MapStore, QGIS, etc.) we want to update its bbox. Updating the GeoNode's dataset bbox is not enough, since the OGC services wouldn't refelct the updated bbox.
We want to implement a helper function (to be used in multiple places) to trigger the recalculation. The geoserver-restconfig library could also be condiered for its implementation.
The helper function will offer:
- the option to ask Geoserver to recalculate the bbox from data, or forse the layer's bbox (e.g. when setting the bbox from the client map view).
- obtain the updated bbox
- update dataset bbox with
ResourceBase.set_bbox_polygon()
Vector dataset
Basically a PUT
request to /workspaces/{workspaceName}/featuretypes/{featureTypeName} with the recalculate query parameters is enough.
Example : http://localhost/geoserver/rest/workspaces/geonode/datastores/geonode_data/featuretypes/mylayer?recalculate=nativebbox,latlonbbox
The featuretype JSON body is requested, but an empty one seems to be accepted;
{
"featureType": {
}
}
Raster dataset
PUT
on /workspaces/{workspace}/coveragestores/{store}/coverages/{coverage}
with calculate
query paramater (notice it's different from featuretypes).
E.g. http://localhost/geoserver/rest/workspaces/geonode/coveragestores/dem/coverages/dem?calculate=nativebbox,latlonbbox
The coverage JSON body is required, but an empty one is accepted:
{
"coverage": {
}
}