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.
Initialize the Web Extensions and connect to the Server using<br />
// the Web Extensions session identifier stored in PHP<br />
// session state.<br />
MgInitializeWebTier ($configFilePath);<br />
$userInfo = new MgUserInformation($mgSessionId);<br />
$siteConnection = new MgSiteConnection();<br />
$siteConnection-><strong>Open</strong>($userInfo);<br />
$resourceService = $siteConnection->CreateService(<br />
MgServiceType::ResourceService);<br />
$featureService = $siteConnection->CreateService(<br />
MgServiceType::FeatureService);<br />
$queryOptions = new MgFeatureQueryOptions();<br />
$map = new MgMap();<br />
$map-><strong>Open</strong>($resourceService, $mapName);<br />
// ----- Beginning of AJAX-specific code ----------<br />
// Create the selection object by retrieving the current<br />
// selection from the map.<br />
$selection = new MgSelection($map);<br />
$selection-><strong>Open</strong>($resourceService, $mapName);<br />
// ----- End of AJAX-specific code ----------------<br />
$layers = $selection->GetLayers();<br />
if ($layers)<br />
{<br />
for ($i = 0; $i < $layers->GetCount(); $i++)<br />
{<br />
// Only check selected features in the Parcels layer.<br />
$layer = $layers->GetItem($i);<br />
if ($layer && $layer->GetName() == 'Parcels')<br />
{<br />
48 | Chapter 3 Working With Feature Data<br />
// Create a filter containing the IDs of the selected<br />
// features on this layer