Developer's Guide - MapGuide Open Source - OSGeo
Developer's Guide - MapGuide Open Source - OSGeo
Developer's Guide - MapGuide Open Source - OSGeo
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Inserting, Deleting, and Updating Features<br />
To change data in a feature source, create an MgFeatureCommandCollection<br />
object. This can contain commands to insert, delete, or update features in an<br />
FDO data source. The commands are executed sequentially. For FDO providers<br />
that support transaction processing, the commands can be treated as a single<br />
transaction.<br />
Feature commands can be one of the following:<br />
■ MgDeleteFeatures<br />
■ MgInsertFeatures<br />
■ MgUpdateFeatures<br />
To execute the commands, call MgFeatureService::UpdateFeatures(). The<br />
feature class name and property names in any of the feature commands must<br />
match the class name and property names in the feature source.<br />
For example, to delete all features in a feature class with an identity property<br />
ID, execute the following:<br />
$commands = new MgFeatureCommandCollection();<br />
$deleteCommand = new MgDeleteFeatures($className, "ID like '%'");<br />
$commands->Add($deleteCommand);<br />
$featureService->UpdateFeatures($feature<strong>Source</strong>, $commands, false);<br />
To insert features, create an MgPropertyCollection object that contains the<br />
properties of the new feature. Create an MgInsertFeatures object and add<br />
this to the MgFeatureCommandCollection object.<br />
For example, to add a new feature with a single geometry property, execute<br />
the following:<br />
Inserting, Deleting, and Updating Features | 79