[GeoNode-devel] Update the BBOX of an existing layer

Dimitris Karakostis karakostis.dimitris at gmail.com
Wed Sep 14 00:35:50 PDT 2016


Yiasou Tom,

Thanks for your answer. I have also found out that the signal you mentioned
does this. Instead of calling  layer.save(), I execute the signal directly
in my application as:

from geonode.catalogue.models import catalogue_post_save
from geonode.layers.models import Layer
layer = _resolve_layer(
            request,
            layer_name,
            'base.change_resourcebase_metadata',
            _PERMISSION_MSG_METADATA)
instance = layer
catalogue_post_save(instance, Layer)

In my workflow, I have a layer with a specific BBOX. Then I add a new
feature (e.g. a point), which is outside this BBOX. To add the point I send
a WFS INSERT POST request. The point is added successfully and its visible
in Geoserver (layer preview). I also send another request to "recalculate"
the BBOX displayed in the layer's page in Geoserver.

So my question is how to update the BBOX coords stored in the
base_resourcebase table with the BBOX coords, which were recalculated in
Geoserver.

Executing the above signal it doesn't get the BBOX values from the
geoserver but the ones from base_resourcebase so basically nothing is
updated.

I guess what I need to do is when I recalculate the BBOX for the layer in
Geoserver, to pass these new coordinates to the base_resourcebase. But I
can not figure out if there is a signal/function for this.



On Wed, Sep 14, 2016 at 1:06 AM, Tom Kralidis <tomkralidis at gmail.com> wrote:

>
> Yiasou Dimitris:
>
> Some of GeoNode's CSW fields are ancillary fields which are managed via
> signals as opposed to forms/views.
>
> In the GeoNode Layer case, the Layer.csw_wkt_geometry would be the exact
> field
> to update (with WKT of course)
>
> I'm not familiar with your exact workflow/use case, but when saving a
> layer,
> the signal in [1] should do this for you automagically given a
> Layer.save() in
> your calling application.
>
> Hope this helps.
>
> ..Tom
>
> [1] https://github.com/GeoNode/geonode/blob/master/geonode/catal
> ogue/models.py#L42
>
>
>
> On Tue, 13 Sep 2016, Dimitris Karakostis wrote:
>
> Date: Tue, 13 Sep 2016 16:47:15 +0200
>> From: Dimitris Karakostis <karakostis.dimitris at gmail.com>
>> To: geonode-devel <geonode-devel at lists.osgeo.org>
>> Subject: Re: [GeoNode-devel] Update the BBOX of an existing layer
>>
>> Hello!
>> Any suggestions on this?
>>
>>
>>
>> On Thu, Aug 4, 2016 at 2:17 PM, Dimitris Karakostis <
>> karakostis.dimitris at gmail.com> wrote:
>>
>> Some extra links on geoserver's RESTapi on the recalculate parameter:
>>> http://docs.geoserver.org/stable/en/user/rest/api/featuretypes.html#
>>> recalculate
>>> and the layer_metadata view: https://github.com/wfp-
>>> ose/geonode/blob/master/geonode/layers/views.py#L297
>>>
>>> Thanks
>>> Dimitris
>>>
>>> On Thu, Aug 4, 2016 at 2:10 PM, Dimitris Karakostis <
>>> karakostis.dimitris at gmail.com> wrote:
>>>
>>>
>>>>
>>>> I am working on the development of a functionality where the user can
>>>> add/edit the location of existing features (points etc.)
>>>>
>>>> When I add the new point then I use the <<recalculate>> parameter (from
>>>> geoserver) in order to update the BBOX in the geoserver.
>>>>
>>>> But I can not find out how to update the BBOX stored in the CSW.
>>>> I have found out, that if I manually update the layer's metadata, then
>>>> the BBOX in the model is replaced with the correct one.
>>>>
>>>> But looking at the layer_metadata view, I am not sure, which is the
>>>> function that actually does this.
>>>> Can someone point me to the right direction?
>>>>
>>>> Thanks.
>>>> Dimitris
>>>>
>>>>
>>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20160914/d11152ae/attachment.html>


More information about the geonode-devel mailing list