[Mapserver-users] Dynamic point creation problems - setXY yields error
Daniel Morissette
morissette at dmsolutions.ca
Mon Dec 9 14:13:30 PST 2002
"Lars V. Nielsen" wrote:
>
> Code snippet:
> while ($row = mssql_fetch_row($rs)) {
> $px = $row[1]; // Easting
> $py = $row[2]; // Northing
> fputs ($fp, " Coordinate (utm32): ".$px." , ".$py."\r\n");
> $pt = ms_newPointObj() or die("Cannot create new point object");
> $pt->setXY($px,$py) or die("Cannot assign XY to new point object"); // adding 3rd parameter doesn't help !
> ...
>
> It aborts with
> Cannot assign XY to new point object
> but the previous dump statement produces a valid output:
> Coordinate (utm32): 724192.12 , 6175749.4
>
The setXY() method returns 0 on success, -1 on error. This was not
clear in the docs and I have updated the docs for 3.7
Unfortunately in MapServer's core some functions return 0/-1 and others
return MS_SUCCESS/MS_FAILURE and this happens as well in MapScript ...
new functions are written to use MS_SUCCESS/FAILURE, but the old ones
still carry their original 0/-1 return codes. So you should always be
careful and check the docs when testing return values.
Daniel
--
------------------------------------------------------------
Daniel Morissette morissette at dmsolutions.ca
DM Solutions Group http://www.dmsolutions.ca/
------------------------------------------------------------
More information about the MapServer-users
mailing list