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

Dimitris Karakostis karakostis.dimitris at gmail.com
Thu Sep 15 01:09:51 PDT 2016


Hello all,

That worked well. I used the gsconfig to get the recalculated BBOX coords
from Geoserver and then I updated the base_resourceBase table as Simone
suggested.
I also had to use the bbox_to_wkt() function to create the appropriate WKT
format before I make the update.

Thanks for the help.
Dimitris






On Wed, Sep 14, 2016 at 10:09 AM, Simone Dalmasso <simone.dalmasso at gmail.com
> wrote:

> I see,
>
> you would have to get the result of the recalculate function in geoserver,
> if it returns one, and update the bbox in the resourcebase accordingly. I
> suggest to use a ResourceBase.objects.filter(pk=layer.id).update() to do
> that.
>
> 2016-09-14 9:35 GMT+02:00 Dimitris Karakostis <
> karakostis.dimitris at gmail.com>:
>
>> 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
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>
>> _______________________________________________
>> geonode-devel mailing list
>> geonode-devel at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/geonode-devel
>>
>>
>
>
> --
> Simone
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20160915/60692bd2/attachment.html>


More information about the geonode-devel mailing list