MapTools.org

[maplab-users] MapSession_RW not working

Matt Doggett mdoggett@coas.oregonstate.edu
Tue, 13 May 2003 11:58:41 -0700
Voila'!

Thanks for all your suggestions as they were all correct, it was the
implementation that was wrong.  In order to get it working I had to do
the following THREE steps:
1. In globprefs.php, change the $oMapSession instantiation from a
read-only (_R) to a read/write object 
   $oMapSession = new MapSession_RW;

2. In the function drawMainMap, enable map_session_mode in the
$urlMainMap string.
   (i.e. map_session_mode=1)

3*. In drawMainMap, add the gszTmpMapPath the $urlMainMap string. This
was the missing link.
    ."&gszTmpMapPath=".TMP_DIR

*Previously, because the temporary directory was not sent to the
drawmap.php URL, the app would fail, although no messages were posted
anywhere.

The Read/Write MapSession capability is a real slick way for dynamic
generation of mapfiles and works like a charm!...now that it works. :)
It will let me dynamically generate mapfiles so that a certain layer
object's data member is modified to point to one of hundreds of
different raster layers on disk based on a user's inputs to a form. 

-Matt

Ps. The alternative was to have a single (static) mapfile with hundreds
of (identical except for the data value) layers defined...yuck.

> -----Original Message-----
> From: maplab-users-admin@dmsolutions.ca [mailto:maplab-users-
> admin@dmsolutions.ca] On Behalf Of Matt Doggett
> Sent: Tuesday, May 13, 2003 9:13 AM
> To: 'Paul Spencer'; sfournier@dmsolutions.ca
> Cc: maplab-users@dmsolutions.ca
> Subject: RE: [maplab-users] MapSession_RW not working
> 
> Good suggestion! I hoped you were on to something. I tried the
hard-code
> approach setting map_session_mode=1 in drawMainMap but now I get
*worse*
> results, now the application simply draws a blank...not even the
default
> map appears. The log.txt file shows successful operations: saveState()
> and writeMapFile(), etc. The applet simply displays nothing.
> 
>   Is this a problem with the Rosa applet perhaps?
> 
> md
> 
> 
> > -----Original Message-----
> > From: Paul Spencer [mailto:pgs@magma.ca]
> > Sent: Tuesday, May 13, 2003 9:00 AM
> > To: Matt Doggett; sfournier@dmsolutions.ca
> > Cc: maplab-users@dmsolutions.ca
> > Subject: RE: [maplab-users] MapSession_RW not working
> >
> > I think I see the problem.  drawmap.php can operate with the map
> session
> > stuff in either
> > mode but it needs to know *which* mode it is in.  If you check the
> > documentation in
> > drawmap.php, you should see some comments about a URL parameter
> > called "map_session_mode".  I believe it assumes MapSession_R if you
> pass
> > nothing or 0
> > (map_session_mode=0) for this value, and MapSession_RW if you pass a
1
> for
> > this value
> > (map_session_mode=1).
> >
> > If drawmap.php is assuming MapSession_R and you are actually using
> > MapSession_RW then you
> > will only every see the original map file with no changes, which is
> what
> > you are
> > experiencing.
> >
> > The fix is to modify the drawMainMap to be aware of the difference
> between
> > MapSession_R
> > and MapSession_RW.  I'm not sure what the best approach for this is,
> but
> > the short term
> > hack would be to modify the URL generated here to append
> > &map_session_mode=1 to the URL
> > (I don't have the code in front of me, so it is possible this is the
> wrong
> > name and/or
> > value, but check drawmap.php to see exactly what it says there).
> >
> > Cheers,
> >
> > Paul
> >
> > --
> > Paul Spencer
> > Applications and Software Development
> > DM Solutions Group Inc.
> > http://www.dmsolutions.ca
> >
> >
> >
> > On May 13, "Matt Doggett" <mdoggett@coas.oregonstate.edu> wrote:
> > >
> > > If that's the case then the application (as delivered by
> DMSolutions) is
> > > broke because that's exactly what I'm doing.  As best I can
> determine,
> > > the problem is in the drawMainMap function and/or the
> > > wrapper/drawmap.php script. I've even tried modifying the URL (in
> > > drawMainMap) passed to the drawmap.php script to explicitly use
the
> > > temporary mapfile (e.g. drawmap.php?gszMapName=$tmpMAPFILE) but
> drawmap
> > > will never render anything but the original .map file.
> > >
> > > Any other suggestions?
> > >
> > > matt
> > >
> > > > -----Original Message-----
> > > > From: Sacha Fournier [mailto:sfournier@dmsolutions.ca]
> > > > Sent: Tuesday, May 13, 2003 5:13 AM
> > > > To: mdoggett@coas.oregonstate.edu
> > > > Cc: maplab-users@dmsolutions.ca
> > > > Subject: Re: [maplab-users] MapSession_RW not working
> > > >
> > > > Hi Matt,
> > > >
> > > > Theorictly you only have to change your object to RW and set the
> temp
> > > > directory of your object by calling
> > > > $obj->setTempDir([tmp_dir_of_your_maps]);
> > > >
> > > > Sacha
> > > >
> > > > Matt Doggett wrote:
> > > > > I am trying to customize my GmapFactory application to
generate
> a
> > > > > dynamic mapfile based on user inputs to an HTML form.
> > > > > After extensive trial/error I finally have a feel for how the
> Gmap
> > > > > application works and this led me to declaring a MapSession_RW
> > > object
> > > > > for $oMapSession (rather than the default MapSession_R object
> > > > > instantiated in globprefs.php).
> > > > > However, when I do this, the map display will not update at
> > > all...zoom,
> > > > > pan, selecting different layers, etc are all ignored and only
> the
> > > > > original (default) map is displayed in the Rosa applet.
> > > > > If I look in $gszTmpMapPath I find the temporary mapfiles that
> are
> > > > > created, and these mapfiles do reflect the changes made by the
> user.
> > > > > My question then is what additional change should I make so
that
> the
> > > > > rosa applet gets the correct (modified) mapfile to display?
> > > > > This may be related to using map_session_mode=1 but I can't
seem
> to
> > > get
> > > > > that to work either.
> > > > > Anyone else been down this road???
> > > > >
> > > > > Md
> > > > >
> > > > > (RedHat8.0, Apache2.0, Mapserver 3.6.4, Php4.2.3)
> > > > >
> > > > > Matt Doggett
> > > > > Spatial Climate Analysis Service
> > > > > Oregon State University
> > > > > 316 Strand Ag Hall
> > > > > Corvallis, OR 97331
> > > > > (541)737-9153
> > > > > mdoggett@coas.oregonstate.edu
> > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Maplab-users mailing list
> > > > > Maplab-users@dmsolutions.ca
> > > > > <a href='http://lists.dmsolutions.ca/mailman/listinfo/maplab-
> > users'>http://lists.dmsolutions.ca/mailman/listinfo/maplab-users</a>
> > > > >
> > > >
> > > > --
> > > > Sacha Fournier
> > > > Applications Developer
> > > > DM Solutions Group
> > > > sfournier@dmsolutions.ca
> > > > tel: 418.696.5056
> > > > fax: 418.696.5056
> > > >
> > > > www.dmsolutions.ca
> > > > --
> > > > -------------------------------------------------
> > > > /"\  ASCII Ribbon Campaign against HTML
> > > > \ /  email and proprietary format
> > > >   X   attachments.
> > > > / \
> > > > -------------------------------------------------
> > >
> > > _______________________________________________
> > > Maplab-users mailing list
> > > Maplab-users@dmsolutions.ca
> > > <a href='http://lists.dmsolutions.ca/mailman/listinfo/maplab-
> > users'>http://lists.dmsolutions.ca/mailman/listinfo/maplab-users</a>
> > >
> 
> _______________________________________________
> Maplab-users mailing list
> Maplab-users@dmsolutions.ca
> http://lists.dmsolutions.ca/mailman/listinfo/maplab-users



This archive was generated by Pipermail.