[Cartoweb-users] How can this error be handled
Pierre GIRAUD
pierre.giraud at camptocamp.com
Thu Mar 9 03:36:40 EST 2006
I didn't take a look at your code but the error you sent us isn't really
explicit.
Probably, you have an "echo" or "print_r" somewhere that prevent the
error to display correctly.
Are you able to check this and send back the real error message on this
list ?
Regards
Pierre GIRAUD
VenuGopal Papasani wrote:
> Hi,
> I have written a plugin which colors the polygon of my map.The
> following is the code wriiteen for
> c:\wamp\www\cartoweb3\plugins\ctr\server\ServerCtr.php.
>
> Before this code there was no problem with the map the map is
> displaying after writing this I was getting the following exception.
>
> I have also made one more changes previously my project
> name is ctr and i used to execute it as ctr.php.As
> <http://ctr.php.As> my plugin name and my project names are same i
> changed it to chittoor.
>
> Now I want to know where the problem actually is.Is it in the
> code or in Renaming my file names.No doubt i have renamed everything
> required.
>
> The Exception is
>
>
> *Fatal error*: Uncaught exception 'CartocommonException' with message
> 'Error [2, Cannot modify header information - headers already sent by
> (output started at
> C:\wamp\www\cartoweb3\plugins\ctr\server\ServerCtr.php:123),
> C:\wamp\www\cartoweb3\client\FormRenderer.php, 301] Backtrace: file:
> UNKNOWN - UNKNOWN call: Common::cartowebErrorHandler(2, "Cannot modify
> header information - headers already sent by (outp...",
> "C:\wamp\www\cartoweb3\client\FormRenderer.php", 301, Array(1)) file:
> 301 - C:\wamp\www\cartoweb3\client\FormRenderer.php call:
> header("HTTP/1.1 500 Internal Server Error") file: 1032 -
> C:\wamp\www\cartoweb3\client\Cartoclient.php call:
> FormRenderer->showFailure(Object(SoapFaultWrapper)) 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") ' in
> C:\wamp\www\cartoweb3\common\Common.php:275 Stack trace: #0 [internal
> function]: Common::cartowebErrorHandler(2, 'Cannot modify h... in
> *C:\wamp\www\cartoweb3\common\Common.php* on line *275*
>
>
> Here is my code
>
> ServerCtr.php
> ------------------
> <?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=1105;$k++)
> {
> $values[k] = rand(0,100);
> }
> return $values;
> }
>
> public function initializeRequest($requ)
> {
> $msMapObj = $this->serverContext->getMapObj();
>
> $resultArray = $this->getValues($requ->dataElement_id);
> $msLayer = $msMapObj->getLayerByName('chittoot');
> $no_intervals = 5;
> $color = "Reds"; //dont't think this is necessary
> $this->colorMapFromData($resultArray, $msLayer, $no_intervals,
> $color);
> }
>
> public function buildClassExpressions($numberOfIntervals,$resultArray)
> {
> $max_val = max($resultArray);
> $min_val = min($resultArray);
> $intervalLength = ceil(($max_val - $min_val)/$numberOfIntervals);
> $idsPerClass = array();
> foreach($resultArray as $id => $value)
> {
> $classNo = floor($value/$intervalLength);
> $idsPerClass[$classNo] .= $id. ",";
>
> }
>
> $classes = array();
> for($i=0;$i < $numberOfIntervals+1;$i++)
> {
> if ($classNo[$i])
> $classIds = substr($classNo[$i],o,-1);
> else
> $classIds = "";
>
> $classes[$i] = "([".$idcol. "] IN '" . $classIds .
> "')";
> }
>
> return $classes;
> }
>
> public function colorMapFromData($resultArray, $msLayer,
> $numberOfIntervals, $colorScheme)
> {
> $expressions =
> $this->buildClassExpressions($numberOfIntervals,$resultArray);
> $r = 10;
> $g = 10;
> $b = 10;
>
> for($i=0;$i<numberOfIntervals;$i++)
> {
> $msClass = ms_newClassObj($msLayer);
> $msClass->setexpression($expressions[$i]);
> $msStyle = ms_newStyleObj($msClass);
> $msStyle->color->setRGB($r,$g,$b);
> $r = $r + 10;
> $g = $g + 10;
> $b = $b + 10;
> }
> }
> }
> ?>
>
>
> ctr.ini consists of
> id_col="ID"
>
> Please give me the solution how to solve
> this problem.
> Thanks in Advance,
>
> Regards,
> Venu.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Cartoweb-users mailing list
>Cartoweb-users at lists.maptools.org
>http://lists.maptools.org/mailman/listinfo/cartoweb-users
>
>
--
_________________________________________________________
Pierre GIRAUD
Géomaticien, Analyste
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 93
Mail : pierre.giraud at camptocamp.com
http://www.camptocamp.com
More information about the Cartoweb-users
mailing list