<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:D="DAV:" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="&#1;" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Kristen ITC";
        panose-1:3 5 5 2 4 2 2 3 2 2;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Kristen ITC";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Kristen ITC";
        color:windowtext;}
span.objectbox
        {mso-style-name:objectbox;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-GB link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>Afternoon
all,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>I&#8217;m
hoping someone can help me out, with getting a selection to appear on the map.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>I&#8217;m
using JavaScript to perform an Ajax call to PHP, which runs the following code
to generate the selection XML:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>(Note:
$_itkconfig is a global array used to store any site configuration details, and
folder locations).<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
global $_itkconfig, $session;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//common file from MapGuide Open Source<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;require_once('..\data\common.php');&nbsp;&nbsp; <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//need to include the MapGuide Open Source constants file for
PHP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
require_once($_itkconfig['site']['mapObject']['viewerDir'].'constants.php');<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
try {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//Initialise the web extensions<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgInitializeWebTier($_itkconfig['site']['mapObject']['webConfigFilePath']);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//create a variable to hold the MapGuide user details and then create a
MapGuide site object<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$mapGuideUserInfo = new
MgUserInformation($_itkconfig['site']['mapObject']['userName'],
$_itkconfig['site']['mapObject']['password']);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
catch(MgException $e) {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print &quot;Can not create the MapGuide User.&lt;br /&gt;&quot;;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
die();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
try {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//create a MapGuide site connection object<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$mapGuideSiteConnection = new MgSiteConnection();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$mapGuideSiteConnection-&gt;Open($mapGuideUserInfo);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//obtain an instance of the MapGuide services<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$mapGuideResourceService =
$mapGuideSiteConnection-&gt;CreateService(MgServiceType::ResourceService);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$mapGuideFeatureService =
$mapGuideSiteConnection-&gt;CreateService(MgServiceType::FeatureService);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
catch(MgException $e) {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print &quot;MapGuide Connection Error&lt;br /&gt;\n&quot;;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print &quot;ERROR: &quot;.$e-&gt;GetMessage(&quot;eng&quot;).&quot;\n&quot;;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print $e-&gt;GetStackTrace(&quot;eng&quot;).&quot;\n&quot;;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
try {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$mapGuideMap = new MgMap();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$mapGuideResourceId = new MgResourceIdentifier(&quot;Library://IHMS/Maps/Illuminate_Development_Map.MapDefinition&quot;);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$mapGuideMap-&gt;Create($mapGuideResourceService, $mapGuideResourceId,
&quot;Illuminate_Development_Map&quot;);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
catch(MgException $e) {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print &quot;Can not connect to the Map.&lt;br /&gt;\n&quot;;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print &quot;ERROR: &quot;.$e-&gt;GetMessage(&quot;eng&quot;).&quot;\n&quot;;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print $e-&gt;GetStackTrace(&quot;eng&quot;).&quot;\n&quot;;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
try {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$layer =
$mapGuideMap-&gt;GetLayers()-&gt;GetItem(&quot;Districts_No_Theme_Lay&quot;);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$featureResId = new MgResourceIdentifier($layer-&gt;GetFeatureSourceID());<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$class = $layer-&gt;GetFeatureClassName();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$layerId = $layer-&gt;GetObjectId();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$layerQuery = new MgFeatureQueryOptions();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$layerQuery-&gt;SetFilter(&quot;ID = 2265&quot;);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$featureReader = $mapGuideFeatureService-&gt;SelectFeatures($featureResId,
$class, $layerQuery);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$selection = new MgSelection($mapGuideMap);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;$selection-&gt;AddFeatures($layer, $featureReader, 0);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$selectionXml = $selection-&gt;ToXml();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return $selectionXml;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
catch(MgException $e) {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print &quot;Unable to handle the layer query data.&lt;br /&gt;\n&quot;;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print &quot;ERROR: &quot;.$e-&gt;GetMessage(&quot;eng&quot;).&quot;\n&quot;;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print $e-&gt;GetStackTrace(&quot;eng&quot;).&quot;\n&quot;;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>The
selection XML is then passed back to my JavaScript function which calls:<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt'><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'>parent.parent.SetSelectionXML('selection
XML&#8217;);<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt'><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'>parent.parent.Refresh();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>(Note:
this code is called from the task frame).<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt'><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>I
have to put the XML within quotes within SetSelectionXML otherwise Firebug
throws an error!!<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>This
is where the fun starts. When I run the code nothing on the map is selected,
but the map&#8217;s status bar tells me that one feature has been selected, and
the Properties pane changes from saying &#8220;None Selected&#8221; to having
the Name and Value column headings appear but no data underneath them. So it is
like something has been selected but is just not appearing on the map.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>At
first I thought it was because the layer I am trying to select on is contained within
a folder in the map. So I stripped the map back down, so it just contained the
one layer, but I still get the same thing.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>I
then did a bit of a test. If I select the feature I am trying to select, and
get the XML for it and compare that XML to the XML being generated by my PHP
code &#8211; I&#8217;ve discovered that the layer ID&#8217;s do not match:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'>Layer
ID when I select the feature off the map&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span
class=objectbox>&lt;Layer
id=&quot;1c1db7be-0000-1000-8003-0017a4ce58b0&quot;&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal><span class=objectbox><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'>Layer ID from generated XML from my PHP
code&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Layer
id=&quot;42ea8db8-0000-1000-8001-0017a4ce58b0&quot;&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal><span class=objectbox><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></span></p>

<p class=MsoNormal><span class=objectbox><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'>They&#8217;re almost identical aside from
the first 8 characters, and four further characters in the second to last
block.<o:p></o:p></span></span></p>

<p class=MsoNormal><span class=objectbox><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></span></p>

<p class=MsoNormal><span class=objectbox><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'>Has anyone come across this before, and
know of a fix. Or is the error occurring because of an error in my PHP code??<o:p></o:p></span></span></p>

<p class=MsoNormal><span class=objectbox><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></span></p>

<p class=MsoNormal><span class=objectbox><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'>Thanks in advance </span></span><span
class=objectbox><span style='font-size:12.0pt;font-family:Wingdings'>J</span></span><span
class=objectbox><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p></o:p></span></span></p>

<p class=MsoNormal><span class=objectbox><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></span></p>

<p class=MsoNormal><span class=objectbox><span style='font-size:12.0pt;
font-family:"Calibri","sans-serif"'>Bev</span></span><span style='font-size:
12.0pt;font-family:"Calibri","sans-serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

</div>


<BR>
This email and any attachment are intended solely for the addressee, are strictly confidential and may be legally privileged. If you are not the intended recipient any reading, dissemination, copying or any other use or reliance is prohibited. If you have received this email in error please notify the sender immediately by email and then permanently delete the email. Copyright reserved.<BR>
<BR>
All communications, incoming and outgoing, may be recorded and are monitored for legitimate business purposes. <BR>
<BR>
The security and reliability of email transmission cannot be guaranteed. It is the recipient’s responsibility to scan this e-mail and any attachment for the presence of viruses. <BR>
<BR>
The Capita Group plc and its subsidiaries ("Capita") exclude all liability for any loss or damage whatsoever arising or resulting from the receipt, use or transmission of this email. <BR>
<BR>
Any views or opinions expressed in this email are those of the author only.<BR>
</body>

</html>