[Chameleon] Problem with dynamically generated mapfile

Bergero Claudio Claudio.Bergero at elsag.it
Thu Feb 16 09:03:42 EST 2006


> Hi,
> Since you are regenerating the mapfile on each page hit, I 
> suppose you are using the the readonly mapsession.

Hi,

No, I'm not using the readonly mapsession.

I simply call a php page which dynamically generates a new mapfile at each
page call (using a template with variable substitution); this php code then
continues with the same code in the sample_enhanced.phtml file (from
Chameleon samples).

To give you a quick sample:

<?
 /*******************
	Here there is my php code to dynamically generate a new mapfile 
 *******************/

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


 $szTemplate = "./sample_enhanced.html";
 $szMapFile = "xxx"; // Path to my dynamically generated mapfile

 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  );
 $oApp->CWCExecute();
?>

The result is Chameleon normally called on a mapfile, as if it would be
static.

I don't use MapScript, and I made no changes in the Chameleon code, all code
for dynamic generation is external to Chameleon and I'm sure it works (since
I triple-checked the generated mapfiles).


> In that case, Chameleon is saving the mapfile on disk at each 
> hits. You may try to reuse this new mapfile instead of the 
> dynamically generated one of your own. If you want more info 
> on those subject, don't hesitate to ask.
 
As said, I didn't modifiy any Chameleon script. 
I verified that Chameleon is saving the mapfile on disk at every hits. 

I've no idea about how to reuse this mapfile, I'd appreciate if you'll give
me some details or some documentation to read, if available.


> For your ZoomAllLayer problem, simply add the following 
> metadata in your
> mapfile:
> original_extent "your,extent,comma,separated"

I tried, but an error is generated in parsing the new line. 

My mapfile yet contains an EXTENT line, as described here:
http://mapserver.gis.umn.edu/docs/reference/mapfile/mapObj. This line is
part of the dynamical changes, but I'm sure is compiled correctly.


Thanks for your answer

Claudio


More information about the Chameleon mailing list