[mapserver-users] Drawing a simple filled polygon with PHP/mapscript

indieaz ryan.terpstra at gmail.com
Tue Mar 10 22:25:05 EDT 2009


Been doing a lot of tinkering, have been plotting points on maps with variety
of shapes from database sources etc.  However, I'm now against what I
believe should be an extremely simple problem.

I have a set of coordinates (max lat/long and min lat/long) that make up a
rectangle I need to plot onto my map.  I'm pulling my hair out...I get a
.png image out, but it's empty.  Here's an example of the code I'm trying to
use:

$map = ms_newMapObj();
$layer = ms_newLayerObj($map);
$polygon= ms_newShapeObj(MS_SHAPE_POLYGON);
$polyLine = ms_newLineObj();
$polyLine->addXY(60,60);
$polyLine->addXY(75,60);
$polyLine->addXY(75,75);
$polyLine->addXY(60,75);
$polyLine->addXY(60,60);
$polygon->add($polyLine);

$Class = ms_newClassObj($layer);
$Class->set( "name","MyClass");
// Create a style object defining how to draw features
$lineStyle = ms_newStyleObj($Class);
$lineStyle->color->setRGB(255,255,0);


and my .map file:

MAP

  STATUS ON
  SIZE 600 400
  IMAGECOLOR 255 255 255
  IMAGETYPE PNG
  extent -180 -90 180 90
  PROJECTION
    "init=epsg:4326"
  END

END
-- 
View this message in context: http://n2.nabble.com/Drawing-a-simple-filled-polygon-with-PHP-mapscript-tp2459355p2459355.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the mapserver-users mailing list