I hooked up a transaction listener by adding a bean to the wfs module's
applicationContext.xml. Is there any way to hook it up in a less invasive
manner? Right now I have to compile the wfs module and use it to replace the
stock wfs jar in GeoServer's WEB-INF/lib. I'd rather not replace the whole jar
just to add the listener.
Also, I found what looks to be how one would update a layer's bounding box, but
I can't get it to work. First, I get the layer's LayerInfo from the catalog by
qualified name. From the LayerInfo, I get the associated ResourceInfo, which
has setLatLonBoundingBox and setNativeBoundingBox methods. I pass those the
ReferencedEnvelope returned by
transactionEvent.getAffectedFeatures().getBounds(). I verified that the
returned bounds are correct, but the set*BoundingBox methods don't seem to do
anything. After the transaction is done, the layer's bounds still show up as
0, 0, 0, 0 in both the GeoServer Web UI and WMS GetCaps.
Thanks again for any help,
Ryan
On Jun 10, 2011, at 12:47 PM, Ryan Zoerb wrote:
> I just got around to checking out transaction listeners, and have a couple
> questions. First, how does one register a listener with the Spring context?
> Also, how does one update a layer's bounding box from within a listener? I
> found this page:
> http://geoserver.org/display/GEOS/GSIP+14+-+WFS+Transaction+handling+framework
> and have been looking through the wfs code, but I haven't been able to find
> any more documentation or examples.
>
> Thanks,
> Ryan
>
> On May 23, 2011, at 3:59 PM, Ryan Zoerb wrote:
>
>> Thanks for the responses Gabriel and Andrea. I need to get the bounding box
>> of the actual feature (for zooming to the feature in OpenLayers), so I'll
>> give the transaction listener a try.
>>
>> -Ryan
>>
>> On May 23, 2011, at 11:11 AM, Andrea Aime wrote:
>>
>>> On Mon, May 23, 2011 at 5:50 PM, Gabriel Roldán <[email protected]> wrote:
>>> I may be wrong, but my impression (biased by the meaning of the WMS
>>> layer bounds in the spec) is that the bounds you declare for the layer
>>> are purely informative and intend to declare what the area of validity
>>> for the Layer/FeatureType is. In any case it has to be accurate, so a
>>> good practice would be to set the layer bounds to the intended area of
>>> interest for the layer to start with.
>>> So even if a layer has no features, but represents a state wide set of
>>> something, it'd be good to set the metadata layer bounds to the whole
>>> state bounds, for example.
>>> The GeoServer "calculate bounds" button is merely an utility to simplify
>>> the common case. But IMHO you should set the bounds to the widest
>>> possible area the layer is meant to.
>>>
>>> I agree with Gabriel, bounds are just an indication.
>>>
>>> That said, if you really want to do it anyways, it's possible to roll a
>>> transaction
>>> listener that will try to update the bounds and save them on disk to make
>>> the change persistent.
>>> I would suggest to do it incrementally, that is, just expand the bounds if
>>> you see the inserted/updated feature bounds are outside of the current
>>> layer bounds, for speed reasons.
>>> If you want the bounds to also contract when you do a delete you'll
>>> have to kick a full computation against the layer contents, depending
>>> on how large your data set it, that might be expensive if not intolerable
>>> (computing bounds on Oracle with tens of millions of rows might
>>> take minutes for example)
>>>
>>> Cheers
>>> Andrea
>>>
>>>
>>> --
>>> -------------------------------------------------------
>>> Ing. Andrea Aime
>>> GeoSolutions S.A.S.
>>> Tech lead
>>>
>>> Via Poggio alle Viti 1187
>>> 55054 Massarosa (LU)
>>> Italy
>>>
>>> phone: +39 0584 962313
>>> fax: +39 0584 962313
>>>
>>> http://www.geo-solutions.it
>>> http://geo-solutions.blogspot.com/
>>> http://www.youtube.com/user/GeoSolutionsIT
>>> http://www.linkedin.com/in/andreaaime
>>> http://twitter.com/geowolf
>>>
>>> -------------------------------------------------------
>>
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev_______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users