Adding Dynamic polygon using PHP Mapscript?

Zygmunt Rynduch Z.Rynduch at ECOFYS.PL
Wed Nov 8 05:03:39 PST 2006


Maybe this is what you want:

--------- Mapfile content: ----------

 LAYER 
    NAME        "layer_name"
    STATUS       DEFAULT
    TYPE         POLYGON
    
		PROJECTION
#	projection definition
		END

    CLASS
#	class definition e.g. 	COLOR 255 0 0 
    END
  END 



-------- Mapscript file content: --------

$MyLayer = $map->getLayerByName("layer_name");

$NewLine = ms_newLineObj();
$NewLine->addXY($X1,$Y1);
$NewLine->addXY($X2,$Y2);
$NewLine->addXY($X3,$Y3);
...
$NewLine->addXY($X1,$Y1);
 		  	
$NewShape = ms_newShapeObj(MS_SHAPE_POLYGON);
$NewShape->add($NewLine);
		  	
$label = "some text";
		  	
$NewShape->set("text",$label);
		  	
$MyLayer->AddFeature($NewShape);	
						
$NewShape->free();
$NewLine->free();

I hope this work. On my configuration works (Mapserver 4.8, PHP 5.1.4,
IIS 5.0, Windows 2000 Server)

Zygmunt

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of grabiel at myway.com
Sent: Wednesday, November 08, 2006 8:32 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Adding Dynamic polygon using PHP Mapscript?



Hi
  I have added the dynamic lines on the map using PHP mapscript on
client side browser. Now i want to add a polygon in the sameway, i can
use the dynamic lines algo to add a polygon to the map but the shape
feature that i will add dynamically will be of type line(Inline point
for dynamic point or inline line for dynamic line in the mapfile). Can
anyone guide me howto add the polygon using a shape that will be also of
type polygon so that i can calculate the area of the polygon.
  
Any idea will be highly appreciated
With regards
 Grabiel




_______________________________________________
No banners. No pop-ups. No kidding.
Make My Way  your home on the Web - http://www.myway.com



More information about the MapServer-users mailing list