[Chameleon] Saving ROI's to shapefile

Paul Spencer pspencer at dmsolutions.ca
Fri Sep 2 08:23:53 EDT 2005


Jacob,

I think to construct polygons, you must create a new ShapeObj of the 
appropriate type then compose the polygons by first creating PointObj 
then adding to LineObj.  The LineObj gets added to the ShapeObj.  There 
is a shortcut for adding points to lines:

$oShape = ms_newShapeObj( MS_SHAPE_POLYGON );
$oLine = ms_newLineObj();
foreach( $aPoints as $aPoint )
{
     $oLine->addXY( $aPoint[0], $aPoint[1] );
}
$oShape->add( $oLine );

Documentation?  Ha!

IRRC, a circle is defined by a center point and radius, so you will need 
to calculate a series of points along the edge of the circle from those 
values.  Polygons should be stored as an array of x,y coordinates and 
are probably 'closed' in that the last pair should match the first pair 
(but I'm not exactly sure).



Delfos, Jacob wrote:
> Hi List,
> 
> I'm attempting to build a widget which saves ROI objects to a shapefile, 
> and then adds the shapefile to the map. I'm rurnning into the problem of 
> defining a polygon shapeObj in php_mapscript. In the ShapeObj class, I 
> don't see any method that allows me to define a polygon based on nodes. 
> I'm using rectangles at the moment, but the RectObj class unfortunately 
> does not inherit from the ShapeObj class. Does anyone know a way of 
> doing it?
> 
> Also, is there some documentation about the internal structure of the 
> goCWCROIManager.aROI[i] array? Pulling out the bounding coordinates of a 
> ROI isn't difficult, but I'm not sure how I could pull out a polygon or 
> a circle....
> 
> Regards,
> 
> Jacob
> 
> 
> *JACOB DELFOS
> SPATIAL INFORMATION ANALYST
> *Maunsell Australia Pty Ltd
> 629 Newcastle Street, Leederville, WA 6007
> PO Box 81, Leederville, WA 6902
> Western Australia
> ABN 20 093 846 925
> 
> Tel     + 61 8 9281 6185
> Fax    + 61 8 9281 6297
> _jacob.delfos at maunsell.com_
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon

-- 
+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+


More information about the Chameleon mailing list