<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: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: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="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:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.gmailquote
        {mso-style-name:gmail_quote;}
span.q
        {mso-style-name:q;}
span.e
        {mso-style-name:e;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>And your sure something is selected? How did you select
the feature?<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I can’t imagine the php file isn’t working.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>So, what does your active selection yield after you retrieve it?<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#365F91'>Meaning, after your page calls the function:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#365F91'>$mapSelection = rawurldecode(($_SERVER['REQUEST_METHOD'] ==
"POST")? $_POST['SELECTION']: $_GET['SELECTION']);<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#365F91'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#365F91'>What is the value of $mapSelection afterwards?<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#365F91'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#365F91'>I had a problem passing XML to another page, because the server
recognized it as potentially harmful code…<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#365F91'>I had to add the following ‘ ValidateRequest=”false”
’ to the page directive at the top of the page… not sure how that
works in PHP, but if $mapSelection does not return a valid XML file after you
retrieve it… I’d imagine that it has something to do with the
above.</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#365F91'><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
mapguide-users-bounces@lists.osgeo.org [mailto:mapguide-users-bounces@lists.osgeo.org]
<b>On Behalf Of </b>Jorge Rubio<br>
<b>Sent:</b> Friday, July 13, 2007 12:08 PM<br>
<b>To:</b> MapGuide Users Mail List<br>
<b>Subject:</b> Re: [mapguide-users] Problems with xmlSelection<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<div>
<p class=MsoNormal>Hi Mark, the problems is here<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal> <o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span style='color:#1F497D'>ActiveSelection.GetLayers</span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span style='color:#1F497D'>returns nothing. That means
ActiveSelection wasn't initialized? </span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span style='color:#1F497D'>Could be the class php file
doesn't process properly the posted xmlSelection....</span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span style='color:#1F497D'>I really don't understand what
is wrong... </span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><br>
<br>
<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span class=gmailquote>2007/7/13, Mark Pendergraft <<a
href="mailto:markp@meadgilman.com">markp@meadgilman.com</a>>:</span> <o:p></o:p></p>
<div>
<div>
<p><span style='font-size:11.0pt;color:#1F497D'>Well first off, I would open
the Map with the siteconnection.</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>After you create the new
selection object with the XML selection like so:</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>Dim Selection as New
MgSelection(Map, mapSelection)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>You then need to find out what
layers are selected, then generate a filter for each layer.</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>Then you can use a
featureReader to read the selected objects, and then your code can perform
functions based off of the selection.</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>Here is an example function in
VB (sorry, but I have to translate your guy's php all the time, so I don't feel
that bad)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#4F6228'>'''''''''''''''''''''''''''
Begin Code '''''''''''''''''''''''''''''''''''''''''''</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>Function
MakePolygonFromSelection(ByVal featureService As MgFeatureService, ByVal Map As
MgMap, ByVal JobNo As String, ByVal XmlSel As String) As MgPropertyCollection</span>
<o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><o:p></o:p></p>
<p style='text-indent:.5in'><span style='font-size:11.0pt;color:#4F6228'>' Open
the map with the XML selection that was passed through javascript</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Dim ActiveSelection As New MgSelection(Map, XmlSel)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#4F6228'>
' Get the layers in the activeselection as a mgreadonlylayercollection</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Dim Layers As MgReadOnlyLayerCollection = ActiveSelection.GetLayers</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><o:p></o:p></p>
<p style='text-indent:.5in'><span style='font-size:11.0pt;color:#4F6228'>' I
only want to use the selection if one object was selected…. If you wanted
multiple objects, you would loop through the layers</span><o:p></o:p></p>
<p style='text-indent:.5in'><span style='font-size:11.0pt;color:#4F6228'>' to
find out which layers are selected.. then you could generate an array of
strings containing the selections generated filter (like below)</span> <o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
If Not Layers.GetCount = 1 Then</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
ErrorMessage = "More than one object was selected"</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Return Nothing</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Exit Function</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
End If</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><span style='font-size:11.0pt;color:#4F6228'>' Now get the layer from
the selection </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Dim Layer As MgLayer = Map.GetLayers.GetItem(Layers.Item(0).Name)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><span style='font-size:11.0pt;color:#4F6228'>' Generate the selection
filter for the layer, which you will use to get the selected objects on that
layer </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Dim selectionFilter As String = ActiveSelection.GenerateFilter(Layer,
Layer.FeatureClassName)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><span style='font-size:11.0pt;color:#4F6228'>' create a new
mgFeatureQueryOptions and set the filter to the selection filter obtained from
the active selection set </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Dim queryOptions As New MgFeatureQueryOptions</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
queryOptions.SetFilter(selectionFilter)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><o:p></o:p></p>
<p style='text-indent:.5in'><span style='font-size:11.0pt;color:#4F6228'>' now
create the feature reader, and set it to obtain the objects from the active
selection (using the layer, and the query options created using the
generatefilter command </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Dim fr As MgFeatureReader = featureService.SelectFeatures(New
MgResourceIdentifier(Layer.GetFeatureSourceId), Layer.GetFeatureClassName,
queryOptions)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p style='text-indent:.5in'><span style='font-size:11.0pt;color:#4F6228'>' read
the first feature</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
fr.ReadNext()</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><span style='font-size:11.0pt;color:#4F6228'>'the rest of this code
transfers the geometry from the selected feature to another feature source..</span>
<o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#4F6228'>
' this is where you would insert your code to act upon the map features that
were selected.</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Dim Geom As MgByteReader = fr.GetGeometry(Layer.GetFeatureGeometryName)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Dim geometryProperty As New MgGeometryProperty("Geometry", Geom)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Dim JobNoProperty As New MgStringProperty("JobNo", JobNo)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Dim propertyCollection As New MgPropertyCollection</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
propertyCollection.Add(geometryProperty)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
propertyCollection.Add(JobNoProperty)</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
fr.Close()</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
fr.Dispose()</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
</span><span style='font-size:11.0pt;color:#4F6228'>' this is the end of the
function… you will also want to save your map back to the user session
should you update anything on it. </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
Return propertyCollection</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> End Function</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#4F6228'>''''''''''''''''''''''''''' End
Code '''''''''''''''''''''''''''''''''''''''''''</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>Well, I hope that clears things
up a bit.</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>-Mark Pendergraft</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p><b><span style='font-size:10.0pt'>From:</span></b><span style='font-size:
10.0pt'> <a href="mailto:mapguide-users-bounces@lists.osgeo.org" target="_blank">mapguide-users-bounces@lists.osgeo.org
</a>[mailto:<a href="mailto:mapguide-users-bounces@lists.osgeo.org"
target="_blank">mapguide-users-bounces@lists.osgeo.org</a>] <b>On Behalf Of </b>Jorge
Rubio<br>
<b>Sent:</b> Friday, July 13, 2007 10:41 AM<br>
<span class=q><b>To:</b> MapGuide Users Mail List</span><br>
<b>Subject:</b> Re: [mapguide-users] Problems with xmlSelection</span><o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
<div>
<p>My problems begin before to show selection. $mgSelection is not initialized!<o:p></o:p></p>
</div>
<div>
<p><br>
<o:p></o:p></p>
</div>
<div>
<p>2007/7/13, Scott Hameister <<a href="mailto:scotth@mpower-tech.com"
target="_blank">scotth@mpower-tech.com</a>>: <o:p></o:p></p>
<div>
<div>
<p><span style='font-size:11.0pt;color:#1F497D'>The map needs to be saved and
refreshed before a selection can show</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p><b><span style='font-size:10.0pt'>From:</span></b><span style='font-size:
10.0pt'> <a href="mailto:mapguide-users-bounces@lists.osgeo.org" target="_blank">mapguide-users-bounces@lists.osgeo.org
</a>[mailto:<a href="mailto:mapguide-users-bounces@lists.osgeo.org"
target="_blank">mapguide-users-bounces@lists.osgeo.org</a>] <b>On Behalf Of </b>Jorge
Rubio<br>
<b>Sent:</b> Friday, July 13, 2007 9:35 AM<br>
<b>To:</b> MapGuide Users Mail List<br>
<b>Subject:</b> [mapguide-users] Problems with xmlSelection</span><o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
<div>
<p>Hi list<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>I need to pass an xmlSlection to a php class in order to be used by a member
function<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>Using javascript I get xmlSelection<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>var xmlSel = parent.parent.mapFrame.GetSelectionXML();<br>
<o:p></o:p></p>
</div>
<div>
<p>I post the selection like this<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>someParams + "&SELECTION=" + encodeURIComponent(xmlSel);<br>
<br clear=all>
I get the params at php class file like this<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>$mgSessionId = ($_SERVER['REQUEST_METHOD'] == "POST")?
$_POST['SESSION']: $_GET['SESSION'];<br>
$mapName = ($_SERVER['REQUEST_METHOD'] == "POST")? $_POST['MAPNAME']:
$_GET['MAPNAME']; <br>
$mapSelection = rawurldecode(($_SERVER['REQUEST_METHOD'] == "POST")?
$_POST['SELECTION']: $_GET['SELECTION']);<br>
<o:p></o:p></p>
</div>
<div>
<p>so $mapSelection is an XML string.<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>Then, I need to get that selection<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>$featureService =
$this->site->CreateService(MgServiceType::FeatureService);<br>
$resourceService = $this->site->CreateService(MgServiceType::ResourceService);<o:p></o:p></p>
<p>$map = new MgMap();<br>
$map->Open($resourceService, $mapName);<br>
$mgSelection = new MgSelection($map,$mapSelection);<o:p></o:p></p>
<p>None selection is created!!<o:p></o:p></p>
<p>What I'm doing wrong?<o:p></o:p></p>
<p>Thanks in advance.<o:p></o:p></p>
</div>
<div>
<p><br>
-- <br>
Lic. Jorge Rubio <o:p></o:p></p>
</div>
</div>
</div>
</div>
<p style='margin-bottom:12.0pt'><br>
_______________________________________________<br>
mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users
</a><o:p></o:p></p>
</div>
<p><br>
<br clear=all>
<br>
-- <br>
Lic. Jorge Rubio <o:p></o:p></p>
</div>
</div>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
_______________________________________________<br>
mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users
</a><o:p></o:p></p>
</div>
<p class=MsoNormal><br>
<br clear=all>
<br>
-- <br>
Lic. Jorge Rubio <o:p></o:p></p>
</div>
</body>
</html>