Developer's Guide - MapGuide Open Source - OSGeo
Developer's Guide - MapGuide Open Source - OSGeo
Developer's Guide - MapGuide Open Source - OSGeo
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
$resourceService = $siteConnection->CreateService(<br />
MgServiceType::ResourceService);<br />
$featureService = $siteConnection->CreateService(<br />
MgServiceType::FeatureService);<br />
$map = new MgMap();<br />
$map-><strong>Open</strong>($resourceService, $mapName);<br />
// Get the geometry for the boundaries of District 1<br />
$districtQuery = new MgFeatureQueryOptions();<br />
$districtQuery->SetFilter("Autogenerated_SDF_ID = 1");<br />
$districtResId = new MgResourceIdentifier(<br />
"Library://Samples/Sheboygan/Data/VotingDistricts.Feature<strong>Source</strong>");<br />
$featureReader = $featureService->SelectFeatures(<br />
$districtResId, "VotingDistricts", $districtQuery);<br />
$featureReader->ReadNext();<br />
$districtGeometryData = $featureReader->GetGeometry(<br />
'Data');<br />
// Convert the AGF binary data to MgGeometry.<br />
$agfReaderWriter = new MgAgfReaderWriter();<br />
$districtGeometry = $agfReaderWriter->Read(<br />
$districtGeometryData);<br />
// Create a filter to select the desired features.<br />
// Combine a basic filter and a spatial filter.<br />
$queryOptions = new MgFeatureQueryOptions();<br />
$queryOptions->SetFilter("RNAME LIKE 'Schmitt%'");<br />
$queryOptions->SetSpatialFilter('SHPGEOM',<br />
$districtGeometry,<br />
MgFeatureSpatialOperations::Inside);<br />
// Get the features from the feature source,<br />
// turn it into a selection, then save as XML.<br />
$featureResId = new MgResourceIdentifier(<br />
"Library://Samples/Sheboygan/Data/Parcels.Feature<strong>Source</strong>");<br />
$featureReader = $featureService->SelectFeatures(<br />
$featureResId, "Parcels", $queryOptions);<br />
Example: Setting the Active Selection | 53