|
From: Björn H. <bjo...@bj...> - 2013-02-13 23:19:32
|
On 02/11/2013 01:12 PM, Andrea Aime wrote:
> On Mon, Feb 11, 2013 at 9:20 AM, Björn Höfling <
> bjo...@bj...> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>
>> Hi List,
>>
>> I have a raster layer of old scanned maps. The default GeoServer
>> GetFeatureInfo for this layer will return you the raster value
>> for the coordinate you clicked on. This is not very useful if it
>> is just an RGB triplet (it might be useful if you have a DEM
>> stored as raster of cause).
>>
>> What I want to get as FeatureInfo instead is some Metadata I
>> store in a second layer of type vector. In my case it would
>> contain the bounding box of the original paper map and the year
>> of publishing.
>>
>> Is there any way to realize this with GeoServer? The only thing
>> that came to my mind was to build a compound layer and style the
>> raster layer with an empty HTML template. That would solve my
>> problem with HTML GetFeatureInfo requests, but if the user
>> requests type text or xml, the raster FeatureInfo is still in the
>> response.
>>
>> Do you have any other ideas of how to realize this?
>>
>>
> There is no "configuration" you can do to perform what you're
> looking for, but if you up to programming, you can build a plugin
> implenetation, called a DispatcherCallback, in which you replace on
> the fly the name of the raster layer with the name of the vector
> layer in both the layers and query_layers portion of the request.
Just to be sure, is it really that simple (OK, this is more
pseudocode, check for NPE, etc):
public class FeatureInfoDispatcherCb implements DispatcherCallback {
@Override
public Request init(Request request) {
Map kvp = request.getKvp();
String layers=(String) kvp.get("LAYERS");
layers = layers.replace("_raster", "_vector");
//...
kvp = request.getRawKvp();
//...
return request;
What's the difference between getKvp and getRawKvp? It seams as if I
have to manipulate at least the raw version, otherwise I get back the
original FeatureInfo.
Björn
--
Dipl.-Inf. Björn Höfling
Software Developer (GIS, Java)
http://www.bjoernhoefling.de/
|