[Chameleon] Custom query/Unrectified photo zooming

Tim Badtke TBadtke at eastcentralrpc.org
Wed Aug 9 11:03:53 EDT 2006


Hi all,
 
I'm getting close to getting my historical photo viewer the way I want
it to work.  Users can zoom into an area of interest and a photo grid
will show.  They can select a custom query to view the unrectified photo
in a pop up window.  I am unsure of how to make this photo zoomable.
Paul had some suggestions and I am able to make a new map file from the
user's selection in the custom query code.  Here that is:
 
if( !isset( $_GET[ 'sid'] ) )
   die('no session detected');

// define some vars
define("LOAD_MAPSESSION", 1);
define( 'CHAMELEON_PATH', '/opt/chameleon/htdocs/');

// include the supporting php functions
include(CHAMELEON_PATH."widgets/session.inc.php");
include(CHAMELEON_PATH."widgets/query_utils.php");

// execute the query based on passed coords and the mapsession
$aResults = executeQuery( $oMapSession, $_GET['x'], $_GET['y'] );

if (count($aResults) > 0)
{
   foreach( $aResults as $nLayerIdx => $aResult)
   {
       $oLayer = $oMapSession->oMap->getLayer($nLayerIdx);
       $szName = $oLayer->name;
       if( $szName == 'Photo Index - 2000' )
         {
            foreach($aResult as $aRow)
               {
                 $imagenum=$aRow['TILE_ID'];
                 $map_path='/var/www/html/ecwrpc/map/';
                 $mapFileName=$imagenum . 'image.map';
                 $mapFileHandle=fopen($map_path . $mapFileName, 'w');
                 $stringData="NAME PopupImage\nSTATUS ON\nSIZE 600
450\nEXTENT 0 0 3200 3200\nUNITS FEET\n";
                 fwrite($mapFileHandle,$stringData);
                 $stringData="SHAPEPATH ../ecdata\nIMAGECOLOR 255 255
255\nIMAGETYPE PNG\nWEB\n";
                 fwrite($mapFileHandle,$stringData);
                 $stringData=" IMAGEPATH /var/www/html/ms_tmp/\n
IMAGEURL ../ms_tmp/\nEND\n";
                 fwrite($mapFileHandle,$stringData);
                 $stringData="LAYER\n NAME \"Image\"\n STATUS Default\n
DATA photos/2000/" . $imagenum . ".jpg\n";
                 fwrite($mapFileHandle,$stringData);
                 $stringData=" TYPE RASTER\nEND\nEND\n";
                 fwrite($mapFileHandle,$stringData);
                 fclose($mapFileHandle);

                }
         }
   }
}


The map file works fine and I can see the image but now I need to figure
out how to start a new chameleon session to enable zooming.  I tried
adding the original initialization script for chameleon after the map
file gets written, but I get an error.  I don't know if this is the way
to go about this or not.

 

include( "../../chameleon/chameleon.php" );

$szTemplate = "./hpv.html";
$szMapFile = $map_path . $mapFileName;
echo $szMapFile;
class SampleApp extends Chameleon
{
  function SampleApp()
  {
    parent::Chameleon();
    $this->moMapSession = new MapSession_RW;
    $this->moMapSession->setTempDir( getSessionSavePath());
  }
}
$oApp =  new SampleApp();
$oApp->registerSkin( 'skins/sample' );
$oApp->CWCInitialize( $szTemplate, $szMapFile  );
//bug MT 615: required to get cwcjsapi widget working
$oApp->mnMinimumMaturityLevel = MATURITY_ALPHA;
$oApp->CWCExecute();
?>

 

It appears the pathing ends up wrong.  In the working page before custom
query gets called the map image properties show the link is
/localhost/chameleon//common//wrapper....

 

In the custom query page the image properties show the link is
/localhost/common//wrapper... and I get the error file does not exist:
/var/www/html/common/.  I am not really sure how to resolve this.  I
would appreciate any input as to the best way to go about this.  I'm a
newbie to php programming if that matters.  Hope I summed this up so
it's understandable, if I need to provide more information, just let me
know.

 

 

Thanks,
Tim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20060809/13a5d78f/attachment.html


More information about the Chameleon mailing list