problems with ms_newClassObj
Daniel Morissette
morissette at dmsolutions.ca
Mon Jan 15 17:56:40 PST 2001
Dieter Lehmann wrote:
>
> Hi there,
> I get stuck using mapscript/php3. With my attached code I get an "document
> contains no data".
> Think, something is wrong with the Class-definition.
> (using only the map-file without the definitions of a class everything is o.k.).
>
Dieter,
I tried your script and .map file using PHP3 and recent versions (about
1 week old) of MapScript on Linux and Win98, and in both cases it passes
the classes part, but returns the following error:
Fatal error: MapServer Error in msDrawMap(): Image dimensions not
specified. in ex1.phtml on line 16
... that's because your .map file is missing important parameters like
EXTENTS, SIZE, and a WEB object.
However, I don't think that explains your crash... because "Document
contains no data..." means that the server crashed without generating
any output. How old is your PHP/MapScript DLL (or .so) ? It might be a
good idea to get a more recent one... either compiling the latest
nightly build on Unix, or if you're on Windows there is a recent
precompiled PHP3_MAPSCRIPT.DLL that you can download at
http://www2.dmsolutions.ca/mapserver/dl/ms_3.4pr-win32-ogr-php3-20010103.zip
BTW, setting colors the way you did in the classes would not give the
expected results... the color parameter in a class object in a .map file
is the RGB value, but in MapScript it is a color index obtained from
addColor(). So the following lines in your script:
> $poClass->set("color",255, 0, 0);
> $poClass->set("outlinecolor",255,0,0);
>
Should be replaced with:
$poClass->set("color", $map->addColor(255, 0, 0) );
$poClass->set("outlinecolor", $map->addColor(255, 0, 0) );
Good Luck!
--
------------------------------------------------------------
Daniel Morissette morissette at dmsolutions.ca
http://www.dmsolutions.ca/
------------------------------------------------------------
Don't put for tomorrow what you can do today, because if
you enjoy it today you can do it again tomorrow.
More information about the MapServer-users
mailing list