[mapguide-users] How do I add New Class Property to Existing SDF (php)

Bob Cassarly bob.cassarly at famis.com
Tue Oct 21 10:58:25 EDT 2008

I have been looking for a way to add a new property to an existing class of
an existing SDF file.  Basically I want to add a new data column to an SDF.


All of the examples I have seen that deal with properties/classes create new
SDFs, add the classes then add the data/geom to the SDF.  I suppose I could
make this work by copying data/geom from one SDF to another but I would
prefer to just modify the original SDF.


The code below works however I have been unable to figure how to apply/save
the schema/class changes to the SDF.  Maybe this is not possible in MapGuide


Here is what I have come up with so far..


//get the SDF

$resourceName = "Library://Temp/MySDF.FeatureSource";

$resourceId = new MgResourceIdentifier($resourceName);


//create the new Property

$newProperty = new MgDataPropertyDefinition("MyNewProperty");





//get the existing class from the existing sdf

$schemaName = "MySchema";

//create a "new" class from the existing class defined in the SDF

$newClass = $featureService->GetClassDefinition($resourceId, $schemaName,

//add the new property to the new class



//get-save the new class

$featureService =

$schema = $featureService->DescribeSchema($resourceId, $schemaName);

//get the classes from the schema

$classes = $schema->GetItem(0)->GetClasses();

//add the new class



Bob Cassarly

Sr. Developer

FAMIS Software, Inc.


bob.cassarly at famis.com 

www.famis.com <http://www.famis.com/>  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20081021/4ded7db7/attachment.html

More information about the mapguide-users mailing list