[rosa-users] dyn_legend question

Daniel Morissette dmorissette at dmsolutions.ca
Wed Aug 17 11:01:04 EDT 2005

Stefanie Weykam wrote:
> Hi list,
> I wish to apply the dynamic legend for to (point) query some wms layers
> which are not 'queryable' (XML: queryable="0") but come with nice GIF
> legends. 
> The DYN_LEGEND doesn't quite work yet and I'm not sure if I fully understand
> how ROSA works (zoom, recentre and query are OK). I suspect that the applet
> is not submitting (must it?) when DYN_LEGEND is pressed. .. 

The DYN_LEGEND doesn't query the map on the server: it just takes the 
RGB color value of the pixel that you click on, and returns the label 
associated in that RGB value in the lookup table that you pass to ROSA 
via the DYN_LEGEND parameter. This doesn not require submitting the page 
as everything happens inside the applet.

> According to the ROSA applet parameter description the result will
> -hopefully- show up in the task bar. Is it possible to intercept this string
> somehow and assign it to a variable? (I'm not very skilled in JavaScript
> although I use it occasionally.)

I don't think that's possible without modifying ROSA, but I could be 
wrong since I am not a JavaScript expert either.

> How does the applet 'know' which layer to sample? Can I indicate one? (I
> don't want to query all layers). 

As I wrote above: DYN_LEGEND is not a real spatial query, it just takes 
the RGB color value of a pixel in your map image and returns the 
corresponding label.

> Any hints on how to quickly translate RGB values into hexadecimal RGB values
> are also welcome (I have a colour chart, but the layers have up to 70
> classes!).

Assuming you're using PHP:

   $r = 0;
   $g = 128;
   $b = 255;
   $hexrgb = sprintf("%06x", $r*0x010000 + $g*0x0100 + $b);
   echo $hexrgb;

> I would also like to know what's the difference between 'auto_some-input'
> parameter and 'some-input' parameter?

With the "auto_" prefix in the TB_BUT_..._INPUT parameter value, 
clicking on this button will automatically submit the form and refresh 
the page. Without the "auto_" prefix then the button is only pressed, 
but the form/page is not submitted.

> And perhaps somebody can post an example for the target parameter too,
> please.

http://mapsherpa.com/gmap/ is an example using ROSA, do a "view source" 
in your web browser to see how the parameters are used.

  Daniel Morissette               dmorissette at dmsolutions.ca
  DM Solutions Group              http://www.dmsolutions.ca/

More information about the ROSA-users mailing list