[Cartoweb-users] what this error relates to

VenuGopal Papasani venu.papasani at gmail.com
Fri Mar 10 15:04:38 EST 2006


Hi All,
    I have wrote a small plugin which colors my map.The plugin colors the
map if i have 1 instead of -1 in the line 81 of the following code and
commented out line 108 with only single color.If i have got the following
code then i was getting the following error.
    Can anyone help me in solving this error.And also what changes i have to
make in order to solve this problem.
     One more thing if if i have 1 instead of -1 in the line 81   and
uncommentd line 108 then the map is either not displayed or some of the
polygons are displayed.
    Code and errors are as follows:

   Thanks In advance,

regards,
venu.


Errors:
------.


Class : SoapFaultWrapper
Message : Mapserver error: Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error

Error in msEvalExpression: Failed to parse expression

Error in msyyparse(): syntax error


Backtrace:

file: 222 - C:\wamp\www\cartoweb3\coreplugins\images\server\ServerImages.php
call: ServerContext->checkMsErrors()

file: 305 - C:\wamp\www\cartoweb3\server\Cartoserver.php
call: ServerImages->drawMainmap(Object(Images))

file: 337 - C:\wamp\www\cartoweb3\server\Cartoserver.php
call: Cartoserver->doGetMap(Object(MapRequest))

file: 358 - C:\wamp\www\cartoweb3\server\Cartoserver.php
call: Cartoserver->callWithExceptionCheck("doGetMap", Object(MapRequest))

file: 81 - C:\wamp\www\cartoweb3\server\MapResultCache.php
call: Cartoserver->cacheGetMap(Object(MapRequest))

file: 192 - C:\wamp\www\cartoweb3\server\MapResultCache.php
call: MapResultCache->getMapResultFromServer(Object(MapRequest))

file: 368 - C:\wamp\www\cartoweb3\server\Cartoserver.php
call: MapResultCache->getMap(Object(MapRequest))

file: 104 - C:\wamp\www\cartoweb3\client\CartoserverService.php
call: Cartoserver->getMap(Object(MapRequest))

file: 158 - C:\wamp\www\cartoweb3\client\CartoserverService.php
call: CartoserverService->callDirect("getMap", Object(MapRequest))

file: 226 - C:\wamp\www\cartoweb3\client\CartoserverService.php
call: CartoserverService->callFunction("getMap", Object(MapRequest))

file: 776 - C:\wamp\www\cartoweb3\client\Cartoclient.php
call: CartoserverService->getMap(Object(MapRequest))

file: 892 - C:\wamp\www\cartoweb3\client\Cartoclient.php
call: Cartoclient->getMapResultFromRequest(Object(MapRequest))

file: 1027 - C:\wamp\www\cartoweb3\client\Cartoclient.php
call: Cartoclient->doMain()

file: 38 - C:\wamp\www\cartoweb3\htdocs\client.php
call: Cartoclient->main()

file: 3 - C:\wamp\www\cartoweb3\htdocs\chittoor.php
call: require_once("C:\wamp\www\cartoweb3\htdocs\client.php")

My code Is as follows:
---------------------

<?php         	
	
require_once(CARTOWEB_HOME . 'common/BasicTypes.php');
require_once('DB.php');

class ServerCtr extends ClientResponderAdapter
    implements InitProvider
{


    private $log;
	
    public function __construct()
    {
        parent::__construct();
        $this->log =& LoggerManager::getLogger(__CLASS__);
    }


    public function getInit()
    {
		// Things to learn from the LayerInit
    }

	public function getValues($id)
	{
		$values = array();
		for($k=0;$k<105;$k++)
		{
			$values[$k] = rand(0,100);
		}
		return $values;
	}
	
	public function initializeRequest($requ)
    {
		$msMapObj = $this->serverContext->getMapObj();
		$resultArray = $this->getValues($requ->dataElement_id);
		$this->log->debug("resu arr".$resultArray."and " .count($resultArray));
		$msLayer = $msMapObj->getLayerByName("chittoor");
		$no_intervals = 9;
		$color = "Reds";  //dont't think this is necessary
		$this->colorMapFromData($resultArray, $msLayer, $no_intervals, $color);	
	}
	
	public function buildClassExpressions($numberOfIntervals,$resultArray)
	{
		$max_val = max($resultArray);
		$this->log->debug("max_val".$max_val);
		$min_val = min($resultArray);
		$this->log->debug("min_val".$min_val);
		$intervalLength = ceil(($max_val - $min_val)/$numberOfIntervals);
		$this->log->debug("intervallength".$intervalLength);
		$idsPerClass = array();
		$cn = array(); //addin
		
		for($i=0;$i < $numberOfIntervals+1;$i++)                     
//added this loop1
		{
			$idsPerClass[$i]= "([".$this->getConfig()->id_col . "] IN ";	
		}
		$i = 0;
		foreach($resultArray as $id => $value)
		{
			$classNo = floor($value/$intervalLength);
			$cn[$i] = $classNo; //add in
			$i = $i + 1;
			$idsPerClass[$classNo] .= $id.",";
			$this->log->debug("hello buildclassex ids per c".$idsPerClass[$classNo]);
		}
		$this->log->debug("hai this is i".$i);
		
		$classes = array();
		$idcol = $this->getConfig()->id_col;
		$this->log->debug("hello idcol".$idcol."and ".count($idcol));
			
		for($i=0;$i < $numberOfIntervals;$i++)
		{
			if ($cn[$i]) 		//classNO->cn
			{
				//$classIds = substr($cn[$i],0,-1);
				$classIds = substr($idsPerClass[$classNo],0,-1);               
//added1  i->classNo
				$this->log->debug("classids".$classIds);
			}
			else
				$classIds = "";
					
		//	 $classes[$i] = "([".$idcol. "] IN '" . $classIds . "')";
			 $classes[$i] = $classIds .")";
			 $this->log->debug("classes[i]".$classes[$i]);
			
		}
		return $classes;		
	}
	
	public function colorMapFromData($resultArray, $msLayer,
$numberOfIntervals, $colorScheme)
	{
		$expressions = $this->buildClassExpressions($numberOfIntervals,$resultArray);
		$r = 100;
		$g = 175;
		$b = 255;
		//$msLayer->removeClass(0);
		for($i=0;$i<$numberOfIntervals;$i++)
		{	
		   	$msLayer->removeClass(0);
		   	$msClass = ms_newClassObj($msLayer);
			$msClass->setexpression($expressions[$i]);	//i->j
			//$this->log->debug("Value of Value is" .$expressions[$i]);
			$this->log->debug("expressions[".$expressions[$i]);
			$msStyle = ms_newStyleObj($msClass);
			$this->log->debug("hellohai");
			$msStyle->outlinecolor->setRGB(100,175,250);
			$msStyle->color->setRGB($r,$g,$b);
			$r = $r + 10;
			$g = $g + 3;
			$b = $b -10;
		}
	}
}
?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20060311/09c3c4c8/attachment-0001.html


More information about the Cartoweb-users mailing list