Copyright (c) 2002, DM Solutions Group Inc.
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
// include the globprefs file
include_once( "globprefs.php" );
/* ============================================================================
* HTTP_FORM_VARS array contains the HTTP GET or POST parameters
* ========================================================================= */
$http_form_vars = count( $_POST ) > 0 ? $_POST :
( count($_GET) > 0 ? $_GET : array("") );
//save the current working directory
$cwd = getcwd();
/* ============================================================================
* Re-instate the previous map state
* ========================================================================= */
// determine previous state key
if ( isset( $http_form_vars["PrevStateKey"] ) )
$szPrevStateKey = $http_form_vars["PrevStateKey"];
else
$szPrevStateKey = "";
if($http_form_vars['ViewRegion'] > 0)
$szPrevStateKey = "";
// restore the previous state
$oMapSession->restoreState( $szPrevStateKey, MAPFILE );
// Check if image path and tmp urd directory is set.
// If not use the one specified in .xml config file.
if ($oMapSession->oMap->web->imagepath == "" && $gDefaultImagePath != "")
$oMapSession->oMap->web->set("imagepath", $gDefaultImagePath);
if ($oMapSession->oMap->web->imageurl == "" && $gDefaultImageURL != "")
$oMapSession->oMap->web->set("imageurl", $gDefaultImageURL);
/* ============================================================================
* Process map size.
* ========================================================================= */
// set the height and width of the map
$oMapSession->oMap->set( "width", MAP_WIDTH );
$oMapSession->oMap->set( "height", MAP_HEIGHT );
// log event
//$oMapSession->log( LOG_QUIET, "Set the map width and height to ".$nMapWidth.
// ", ".$nMapHeight."." );
/* ============================================================================
* Check if the mainmap was clicked and update the co-ordinates
* ========================================================================= */
if ( isset( $http_form_vars[ "mainmap_x" ] ) &&
isset( $http_form_vars[ "mainmap_y" ] ) )
{
// set the values into the nav hidden variable
$http_form_vars["INPUT_COORD"] = $http_form_vars[ "mainmap_x" ].",".
$http_form_vars[ "mainmap_y" ];
//paul begin
$queryHit = False;
$gaszWMSResults = array();
// process coordinates
$aszMinMax = explode(";", $http_form_vars["INPUT_COORD"]);
$adMin = explode(",", $aszMinMax[0]);
$adMax = explode(",", $aszMinMax[1]);
// loop through all layers and add to list of layers to query
// NOTE: Layers will only have results generated for them if they
// have a "template" value set. The template value does not have
// to be valid, it could be as simple as "ttt".
$aszLayers = array();
$oMap = $oMapSession->oMap;
$nCount = $oMap->numlayers;
for ( $i=0; $i<$nCount; $i++ )
{
// get layer name
$oLayer = $oMap->getLayer( $i );
// only add if on
if ( $oLayer->status == MS_ON || $oLayer->status == MS_DEFAULT )
// $queryHit = $oLayer->name;
array_push( $aszLayers, $oLayer->name );
}
//array_push( $aszLayers, "outliers" );
// commit
if($http_form_vars["outliers"] != 'outliers')
$oMapQuery->setQueryLayersByName( $aszLayers );
else
$oMapQuery->setQueryLayersByName( "outliers" );
// execute query
//new var for comQuery script
$noGeo = False;
if ( is_numeric( $adMax[0] ) && is_numeric( $adMax[1] ) )
$oResultSet = $oMapQuery->executeRectQuery( $adMin[0],
$adMin[1],$adMax[0], $adMax[1] );
else
$oResultSet = $oMapQuery->executePointQuery( $adMin[0],$adMin[1],$noGeo );
$nCount = $oResultSet->nNumResults;
for ( $i=0; $i<$nCount; $i++ )
{
// process each result set
$aRows = $oResultSet->getResultSet( $i );
if ( is_array( $aRows ) )
{
foreach ($aRows[0] as $key => $value)
{
if(("Filename"== $key) ||("pkvisit" == $key))
{
$queryHit = True;
$linkID = $value;
}
}
}
}
unset($oResultSet);
unset($aRows);
//End Pauls addition
}
/* ============================================================================
* Determine if a zoom factor is called for.
* ========================================================================= */
//if ( strlen(trim($http_form_vars[ "txtZoomFactor" ])) > 0 )
//{
// $nZoomInFactor = $http_form_vars[ "txtZoomFactor" ];
// $nZoomOutFactor = $http_form_vars[ "txtZoomFactor" ];
//}
//else
//{
if($http_form_vars['ViewRegion'] > 0)
{
$szZoomProv = explode(",", $http_form_vars['ViewRegion']);
$nZoomInFactor = $szZoomProv[2];
if ($nZoomInFactor == 2)
{
$http_form_vars["ROSA_CMD"] = "ZOOM_OUT";
$http_form_vars["Zoom_Out_x"] = 2;
$http_form_vars[ "mainmap_x" ] = MAP_WIDTH / 2;
$http_form_vars[ "mainmap_y" ] = MAP_HEIGHT / 2;
$http_form_vars["INPUT_COORD"] = $http_form_vars[ "mainmap_x" ].",".
$http_form_vars[ "mainmap_y" ];
}
}
else
{
$nZoomInFactor = ZOOMIN_FACTOR;
}
$nZoomOutFactor = ZOOMOUT_FACTOR;
//}
/* ============================================================================
* Process navigation commands.
* ========================================================================= */
// check for pan commands
if ( strlen( trim( $http_form_vars["Pan_North_x"] ) ) > 0 )
{
// check mode and set appropriate vars
if ( $http_form_vars['RosaMode'] == 1 )
$http_form_vars["INPUT_COORD"] = "0,0";
else
$http_form_vars[ "mainmap_x" ] = "0";
// set the command
$http_form_vars["ROSA_CMD"] = "PAN_N";
}
if ( strlen( trim( $http_form_vars["Pan_East_x"] ) ) > 0 )
{
// check mode and set appropriate vars
if ( $http_form_vars['RosaMode'] == 1 )
$http_form_vars["INPUT_COORD"] = "0,0";
else
$http_form_vars[ "mainmap_x" ] = "0";
// set the command
$http_form_vars["ROSA_CMD"] = "PAN_E";
}
if ( strlen( trim( $http_form_vars["Pan_South_x"] ) ) > 0 )
{
// check mode and set appropriate vars
if ( $http_form_vars['RosaMode'] == 1 )
$http_form_vars["INPUT_COORD"] = "0,0";
else
$http_form_vars[ "mainmap_x" ] = "0";
// set the command
$http_form_vars["ROSA_CMD"] = "PAN_S";
}
if ( strlen( trim( $http_form_vars["Pan_West_x"] ) ) > 0 )
{
// check mode and set appropriate vars
if ( $http_form_vars['RosaMode'] == 1 )
$http_form_vars["INPUT_COORD"] = "0,0";
else
$http_form_vars[ "mainmap_x" ] = "0";
// set the command
$http_form_vars["ROSA_CMD"] = "PAN_W";
}
//check for clicking on zoomin in html mode
if($http_form_vars['ViewRegion'] > 0){
$http_form_vars["INPUT_COORD"] = $http_form_vars['ViewRegion'];
$http_form_vars["ROSA_CMD"] = "ZOOM_IN";
}
if ( strlen( trim( $http_form_vars["Zoom_In_x"] ) ) > 0 )
{
$http_form_vars["ROSA_CMD"] = "ZOOM_IN";
//set click point to middle of map
$http_form_vars[ "mainmap_x" ] = MAP_WIDTH / 2;
$http_form_vars[ "mainmap_y" ] = MAP_HEIGHT / 2;
$http_form_vars["INPUT_COORD"] = $http_form_vars[ "mainmap_x" ].",".
$http_form_vars[ "mainmap_y" ];
}
//check for clicking on zoomout in html mode
if ( strlen( trim( $http_form_vars["Zoom_Out_x"] ) ) > 0 )
{
$http_form_vars["ROSA_CMD"] = "ZOOM_OUT";
//set click point to middle of map
$http_form_vars[ "mainmap_x" ] = MAP_WIDTH / 2;
$http_form_vars[ "mainmap_y" ] = MAP_HEIGHT / 2;
$http_form_vars["INPUT_COORD"] = $http_form_vars[ "mainmap_x" ].",".
$http_form_vars[ "mainmap_y" ];
}
//check for clicking on zoomfull in html mode
if ( strlen( trim( $http_form_vars["Zoom_Full_x"] ) ) > 0 )
{
$http_form_vars["ROSA_CMD"] = "ZOOM_FULL";
//set click point to middle of map
$http_form_vars[ "mainmap_x" ] = MAP_WIDTH / 2;
$http_form_vars[ "mainmap_y" ] = MAP_HEIGHT / 2;
$http_form_vars["INPUT_COORD"] = $http_form_vars[ "mainmap_x" ].",".
$http_form_vars[ "mainmap_y" ];
}
if($http_form_vars['ViewRegion'])
{
//$http_form_vars[ "mainmap_x"] = "205";
//$http_form_vars[ "mainmap_x"] = "233";
$http_form_vars["RosaMode"] = 1;
}
// process navigation requests
if ( ( ( $http_form_vars['RosaMode'] != 1 && isset( $http_form_vars[ "mainmap_x" ] ) ) ||
($http_form_vars['RosaMode'] == 1 ) &&
$http_form_vars["INPUT_COORD"] != "" &&
isset( $http_form_vars["INPUT_COORD"] ) ))
{
// check the naviagtion command and process
$xNavigate = checkNavigation($oMapNavigator,$http_form_vars["ROSA_CMD"],
$http_form_vars["INPUT_COORD"], $oMapQuery,
$nZoomInFactor, $nZoomOutFactor );
// set the query string variable
if ( strlen( $xNavigate ) > 1 )
{
$szQueryString = $xNavigate;
}
else
$szQueryString = "";
// check for success
if (!$xNavigate )
{
// give error if failed
$oMapNavigator->error(ERROR_NOTICE,"checkNavigation Failed");
}
}
/* ============================================================================
* process keymap click
* ========================================================================= */
if ( isset( $http_form_vars["keymap_x"] ) )
{
// navigate via the keymap
keymapNavigate ($oMapSession, $oMapNavigator, $http_form_vars["keymap_x"],
$http_form_vars["keymap_y"] );
}
/* ============================================================================
* Process the layer status.
* ========================================================================= */
if ( $http_form_vars["NotFirstLoad2"] )
{
updateLayerStatus( $oMapSession->oMap, $http_form_vars );
}
/* ============================================================================
* Set the legend template if not set or invalid.
* ========================================================================= */
clearstatcache();
if ( (strlen(trim($oMapSession->oMap->legend->template)) <= 0) ||
(!file_exists( dirname(MAPFILE)."/".$oMapSession->oMap->legend->template )) )
{
// template doesn't exists so default it
$oMapSession->oMap->legend->set( "template",
APP_PATH."legend_template.html" );
}
/* ============================================================================
* Process the legend template
* ========================================================================= */
$szLegendTemplate = $oMapSession->processLegendTemplate();
/* ============================================================================
* Save the current state.
* ========================================================================= */
$szCurrentState = $oMapSession->saveState();
//restore the current working directory.
chdir($cwd);
/* ============================================================================
* Draw reference map.
* ========================================================================= */
$szTmpCwd = getcwd();
chdir( dirname( MAPFILE ) );
// only draw if exists
if ( file_exists( $oMapSession->oMap->reference->image ) &&
strlen( trim( $oMapSession->oMap->reference->image ) ) > 0 )
$urlReference = drawKeymap( $oMapSession, KEYMAP_WIDTH, KEYMAP_HEIGHT );
// check
if ( $urlReference != "" )
{
$szReference = "
";
}
else
{
$szReference = "
Reference map not found".
"
";
}
// return to cwd
chdir( $szTmpCwd );
/**
* This function determines which navigation button is to be selected
*
* @param $szRosaCmd String - value of 'ROSA_CMD' form variable
* @return String - value to be selected
**/
function checkSelected($szRosaCmd)
{
// return the appropriate button name to select based on last ROSA command
switch ($szRosaCmd)
{
// zoom in
case "ZOOM_IN":
return "ZOOM_IN";
break;
// recenter
case "RECENTRE":
return "RECENTRE";
break;
// query
case "QUERY":
return "QUERY";
break;
// all other
default:
return "ZOOM_IN";
}
}
/**
* This function determines which navigation button is to be selected
*
* @param $oMapNavigator object - The map navigator class object.
* @param $szRosaCmd string - The ROSA command to process.
* @param $szInputCoords string - A comma de-limited list of co-ordinates.
* @param $nZoomInFactor integer - The factor to apply to zoom in.
* @param $nZoomOutFactor integer - The factor to apply to zoom out.
* @return mixed - true if navigation selected or the results of a query.
**/
function checkNavigation($oMapNavigator,$szRosaCmd, $szInputCoords, $oMapQuery,
$nZoomInFactor, $nZoomOutFactor)
{
// only process if coordinates are given
if (isset($szInputCoords))
{
// process coordinates
$aszMinMax = explode(";", $szInputCoords);
$adMin = explode(",", $aszMinMax[0]);
$adMax = explode(",", $aszMinMax[1]);
}
// process commands if necessary
if ( $szRosaCmd != "" && $szRosaCmd != null )
{
// check individual command
switch ($szRosaCmd)
{
// zoom in
case "ZOOM_IN":
//check if for point click
$nDeltaX = $adMax[0] - $adMin[0];
$nDeltaY = $adMax[1] - $adMin[1];
// if the rectangle is very small then treat as a point click
if ($nDeltaX < MIN_RECT && $DeltaY < MIN_RECT)
$oMapNavigator->zoomPoint($nZoomInFactor, $adMin[0], $adMin[1]);
else
$oMapNavigator->zoomRectangle($adMin[0],$adMin[1],$adMax[0],
$adMax[1]);
return true;
break;
// zoom out
case "ZOOM_OUT":
$oMapNavigator->zoomOut($nZoomOutFactor);
return true;
break;
// zoom out
case "ZOOM_FULL":
$oMapNavigator->zoomOut( 999999 );
return true;
break;
// recentre
case "RECENTRE":
$oMapNavigator->recentre($adMin[0],$adMin[1]);
return true;
break;
// pan north
case "PAN_N":
$oMapNavigator->pan( NORTH, 0.75 );
return true;
break;
// pan east
case "PAN_E":
$oMapNavigator->pan( EAST, 0.75 );
return true;
break;
// pan south
case "PAN_S":
$oMapNavigator->pan( SOUTH, 0.75 );
return true;
break;
// pan west
case "PAN_W":
$oMapNavigator->pan( WEST, 0.75 );
return true;
break;
// query
case "QUERY":
// flag that a query is requested
return "QUERY";
break;
// otherwise navigation failed
default:
return false;
}
}
else
{
// no navigation to perform so return true
return true;
}
}
/**
* This function updates the layer status in the map file according to the
* user's selection in the URL.
*
* @param oMap object - The map object to update
* @param szURL string - The URL to parse.
**/
function updateLayerStatus( $oMap, $szURL )
{
// get the list of groups for the map file
$aszGroupNames = $oMap->getAllGroupNames();
// initialize array of layers that are on
$anOnLayers = array();
// get list of groups and/or layers to process
$aszList = $szURL["layer_status"];
// check if is array
if ( !is_array( $aszList ) ) $aszList = array();
//added march 07
array_push($aszList,'Map_of_Canada');
//array_push($aszList,'outliers');
// loop through the list and process
foreach( $aszList as $szLayerOrGroup )
{
// check if the name is a group
if( in_array( $szLayerOrGroup, $aszGroupNames ) )
{
// is a layer so get list of associated layers
$anLayers = $oMap->getLayersIndexByGroup( $szLayerOrGroup );
}
else
{
// check if is array
if ( !is_array( $anLayers ) ) $anLayers = array();
// add as a layer
$oLayer = $oMap->getLayerbyName( $szLayerOrGroup );
array_push( $anLayers, $oLayer->index );
}
$oLayer2 = $oMap->getLayerbyName("Map_of_Canada");
array_push($anLayers,$oLayer2->index);
$oLayer2 = $oMap->getLayerbyName("drainage");
array_push($anLayers,$oLayer2->index);
//$oLayer2 = $oMap->getLayerbyName("WMS_CITS-ROUTE_1:BNDT/NTDB-250K");
//array_push($anLayers,$oLayer2->index);
$oLayer2 = $oMap->getLayerbyName("provNames");
array_push($anLayers,$oLayer2->index);
$oLayer2 = $oMap->getLayerbyName("prov_bound");
array_push($anLayers,$oLayer2->index);
//$oLayer2 = $oMap->getLayerbyName("road_network");
//array_push($anLayers,$oLayer2->index);
$oLayer2 = $oMap->getLayerbyName("icewatch");
array_push($anLayers,$oLayer2->index);
// loop through all the layers and turn them on
foreach( $anLayers as $nLayer )
{
// get layer object
$oLayer = $oMap->getLayer( $nLayer );
// set the layer status
$oLayer->set( "status", MS_ON );
// add to array of layers that have been turned on
array_push( $anOnLayers, $nLayer );
}
}
// loop through all layer and turn off those that are not in the array
$nCount = $oMap->numlayers;
for ( $i = 0; $i < $nCount; $i++ )
{
// check if the index is accounted for in the array of on layers
if ( !in_array( $i, $anOnLayers ) )
{
// create layer object
$oLayer = $oMap->getLayer( $i );
// set the layer status
$oLayer->set( "status", MS_OFF );
}
}
// end of updateLayerStatus function
}
/**
* This function draws the scalebar and returns the image handle of it
*
* @param $oSession object - The current session object
* @return image handle - The mapscript image handle of the scalebar.
**/
function drawScalebar( $oSession )
{
// log entry
$oSession->logFuncStart( LOG_VERBOSE, "drawScalebar() starting" );
// get the session map object
$oMap = $oSession->getMapObj();
// draw the scalebar
$imgScalebar = $oMap->drawScaleBar();
// get the image handle
//$url = $imgScalebar->saveWebImage( IMAGE_TYPE, 0, 0, -1 );
$url = $imgScalebar->saveWebImage( );
// log exit
$oSession->logFuncEnd( LOG_ALL, "drawScalebar() done" );
// return the image handle
return $url;
// end drawScalebar function
}
/**
* This function returns a Mapscript image object of the keymap.
*
* @param $oSession object - The current map session object.
* @param string $nWidth integer - The width if the keymap.
* @param string $nHeight integer - The height of the keymap.
* @return object - Image object of the keymap.
**/
function drawKeymap( $oSession, $nWidth = "", $nHeight = "" )
{
// log entry
$oSession->logFuncStart( LOG_VERBOSE, "drawKeymap() starting" );
//preserve current path and change to the mapfile directory.
$cwd = getcwd();
chdir(dirname($oSession->szMapFile));
// get the session map object
$oMap = $oSession->getMapObj();
// get the reference map object
$oRef = $oMap->reference;
// set the width and height if necessary
if ( $nWidth != "" && $nHeight != "" )
{
$oRef->set( "width", $nWidth );
$oRef->set( "height", $nHeight );
}
// draw the keymap
$imgKeyMap = $oMap->drawreferencemap();
// get the image handle
//$url = $imgKeyMap->saveWebImage( IMAGE_TYPE, 0, 0, -1 );
$url = $imgKeyMap->saveWebImage();
//restore path
chdir($cwd);
// log exit
$oSession->logFuncEnd( LOG_ALL, "drawKeymap() done" );
// return the image handle
return $url;
// end drawKeymap function
}
/**
* This function takes the keymap click co-ordinates and recenters the map
* accordingly.
*
* @param $oSession object - The map session object.
* @param $oNavigate object - The map navigation object.
* @param $nX integer - The keymap X click position in pixels.
* @param $nY integer - The keymap Y click position in pixels.
**/
function keymapNavigate ( $oSession, $oNavigate, $nX, $nY )
{
// log entry
$oSession->logFuncStart( LOG_VERBOSE, "keymapNavigate() starting" );
// get local map object
$oMap = $oSession->getMapObj();
// get x click position
$nMapXClick = keymapToMap( $oMap->width, $oMap->extent->minx,
$oMap->extent->maxx, MAX_EXT_MINX, MAX_EXT_MAXX, $nX,
KEYMAP_WIDTH, $oSession, true);
// get y click position
$nMapYClick = keymapToMap( $oMap->height, $oMap->extent->miny,
$oMap->extent->maxy, MAX_EXT_MINY, MAX_EXT_MAXY, $nY,
KEYMAP_HEIGHT, $oSession, false);
// recenter to the click position
$oNavigate->recentre( $nMapXClick, $nMapYClick );
// log the x and y parameters
$oSession->log( LOG_QUIET, "X & Y Parameters are: $nMapXClick,
$nMapYClick");
// log exit
$oSession->logFuncEnd( LOG_ALL, "keymapNavigate() done" );
}
/**
* This function calculates the corresponding map click given a keymap click.
*
* @param $nMapPix integer - The map width or height in pixels.
* @param $nMapGeo integer - The change in current map extents
* (i.e. maxX - minX).
* @param $nMapGeoMax integer - The change in max map extents.
* @param $nKeyPixClick integer - The keymap click position in pixels.
* @param $nKeyPix integer - The width or height of the keymap in pixels.
* @return integer - The map click position in pixels.
**/
function keymapToMap ( $nMapPix, $nMapMinGeo, $nMapMaxGeo, $nMapMinGeoMax,
$nMapMaxGeoMax, $nKeyPixClick, $nKeyPix, $oSession,
$bX )
{
// log entry
$oSession->logFuncStart( LOG_VERBOSE, "keymapToMap() starting" );
// calculate the difference in extents
$nMapGeo = $nMapMaxGeo - $nMapMinGeo;
$nMapGeoMax = $nMapMaxGeoMax - $nMapMinGeoMax;
// calculate the pixel value of the maximum map extents (i.e. width or
// height of map at maximum extents)
$nMapPixMax = ( $nMapPix * $nMapGeoMax ) / $nMapGeo;
// calculate the map click distance
$dClickDistance = ( $nKeyPixClick * $nMapPixMax ) / $nKeyPix;
// calculate the value to translate the origin
if ($bX)
$dDeltaOrigin = (($nMapMinGeo - $nMapMinGeoMax) * $nMapPix) / $nMapGeo;
else
$dDeltaOrigin = (($nMapMaxGeoMax - $nMapMaxGeo) * $nMapPix) / $nMapGeo;
// calculate the return value
$dReturnValue = $dClickDistance - $dDeltaOrigin;
// log exit
$oSession->logFuncEnd( LOG_ALL, "keymapToMap() done" );
// return the results
return $dReturnValue;
// end keymapToMap function
}
/**
* This function outputs the html code that draws the main map either by applet
* or by url.
*
* @param $nRosa integer - Flag indicating if rosa is used.
* @param $szCommand string - The last command issued on the map.
* @param $oSession object - The current map session object.
* @param $PrevStateKey string - The last known state of the map.
* @param $aszRosaTools array - Array of tools to include for ROSA.
**/
function drawMainMap( $nRosa, $szCommand, $oSession,
$PrevStateKey, $aszRosaTools, $szInputCoords,$szFrenchNames,$szOutliers,$szViewRegion )
{
// get the current map object
$oMap = $oSession->getMapObj();
// get the selected toolbar button
$szButton = checkSelected($szCommand);
// determine if a query is to be run
if ( $szCommand == "QUERY" )
{
$nRunQuery = 1;
}
else
{
$nRunQuery = 0;
}
// build the url for the map image
$encodedMap = rawurlencode(MAPFILE);
$urlMainMap = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).
"/wrapper/drawmap.php?gszMapName=".$encodedMap."&gszCurrentState=".
$PrevStateKey."&map_session_mode=0&run_query=".$nRunQuery.
"&gszPHPMapScriptModName=".MS_MODULE."&gszQueryCoords=".
$szInputCoords."&language=".$szFrenchNames."&outliers=".$szOutliers."&ViewRegion=".$szViewRegion;
// draw the the map as an applet of ROSA is on
if ( $nRosa == 1 || !isset( $nRosa ) )
{
// draw the map as a ROSA applet
echo "