[Chameleon] OpenLayers and Query widget

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Thu Oct 19 16:59:31 EDT 2006


Hi list,

as a proof of concept I have integrated the Chameleon Query widget with 
OpenLayers. Paul, if you want me to move this to the dev list, let me know.

To do this I wrote an OpenLayersQuery widget, which has a Button and a 
Popin, and calls the default QueryResults.phtml from Chameleon's Query 
widget. It attaches itself to the OpenLayers event using 
map.events.register ('click').

I had to add a few things in QueryResults.phtml, since now OpenLayers 
manages things like EXTENT and WIDTH and HEIGHT of the MAP object:

    if (isset($http_form_vars["MAP_WIDTH"]))
    {
      $oMap->set("width", $http_form_vars["MAP_WIDTH"]);
    }
    if (isset($http_form_vars["MAP_HEIGHT"]))
    {
      $oMap->set("height", $http_form_vars["MAP_HEIGHT"]);
    }
    if (isset($http_form_vars["BBOX"]))
    {
      $aszBBOX = explode(",", $http_form_vars["BBOX"]);
      $oMap->setExtent($aszBBOX[0], $aszBBOX[1], $aszBBOX[2], $aszBBOX[3]);
    }

but this does not break the old way of calling QueryResults.phtml.

There are a few issues wrt sometimes not being able to close the Popin, 
but I don't know if this is a problem of Chameleon or a problem of 
OpenLayers.

The stuff can be downloaded from:

http://www.osgis.nl/download

Example application using this:
..
<body onload="CWC2OnLoadFunction();">
<form>
<cwc2 type="OpenLayersQuery" visible="true" imagetip="Identify Feature" 
styleresource="NavButtons" image="icons/icon_query.png">
  <image state="normal"/>
  <image state="hover"/>
  <image state="selected"/>
</cwc2>
<cwc2 type="MapOpenLayers" visible="true"/>
</form>
</body>
..

Best regards,
Bart

-- 
Bart van den Eijnden
OSGIS, Open Source GIS
bartvde at osgis.nl
http://www.osgis.nl



More information about the Chameleon mailing list