[mapguide-users] Problems with SetSelectionXML

Dragan Podvezanec dragan.podvezanec at gmail.com
Mon Aug 4 09:04:52 EDT 2008




Dragan Podvezanec wrote:
> 
> Hi all.
> 
> I use latest MGOS, and layers from Oracle with king.oracle provider. Since
> with default Search tool from studio centering the map on selection
> doesn't work for me, i wrote my own search script, which connects to
> Oracle, makes a query and fetches object ID and coordinates (using
> SDO_UTILS VERTICES). If someone needs code, I can share it. After that I
> pass ID to map server FeatureReader, to make Selection. It seems like it
> all works, since EscapeForHtml($sel) looks like this:
> 
> <?xml version="1.0"
> encoding="UTF-8"?><FeatureSet
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="FeatureSet-1.0.0.xsd">
> <Layer id="5902d6a8-0000-1000-8004-005056c00008">
> <Class id="KingOra:ADRESNI_SUSTAV~GEOMETRY">
> <ID>AAAAAADAiUA=</ID> </Class>
> </Layer></FeatureSet>
> 
> So I have X , Y to make centering and zooming, and I have selection. Now I
> pass all parameters to zoom.php in scriptFrame target with POST, and then
> i execute javascript to zoom and center, like this:
> 
> <head>
> 	<script language="javascript">
> 		function OnPageLoad()
> 		{
> 			<?php 
> 			if ($selText!="") 
> 				{
> 				echo "parent.mapFrame.SetSelectionXML('".$selText."');";
> 				echo "parent.mapFrame.ZoomToView(".$x.",".$y.",300,true)";
> 				} else {
> 				echo "parent.mapFrame.ZoomToView(".$x.",".$y.",300,true)";
> 				}
> 			?>
> 		}
> 	</script>
> </head>
> 
> <body onload="OnPageLoad()">
> </body>
> 
> 
> Now I have reverse problem as my original one: map zooms and centers on X
> and Y, this works excellent, but nothing gets selected although in
> scriptFrame source I can see:
> 
> function OnPageLoad()
> {
> parent.mapFrame.SetSelectionXML('&lt;?xml version=&quot;1.0&quot;
> encoding=&quot;UTF-8&quot;?&gt;&lt;FeatureSet
> xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
> xsi:noNamespaceSchemaLocation=&quot;FeatureSet-1.0.0.xsd&quot;&gt;
> &lt;Layer id=&quot;5902d6a8-0000-1000-8004-005056c00008&quot;&gt;
> &lt;Class id=&quot;KingOra:ADRESNI_SUSTAV_~GEOMETRY&quot;&gt;
> &lt;ID&gt;AAAAAADAiUA=&lt;/ID&gt; &lt;/Class&gt;
> &lt;/Layer&gt;&lt;/FeatureSet&gt;');parent.mapFrame.ZoomToView(5604102.95228933,5131454.39961872,300,true)
> }
> 
> So, I guess, question would be: why nothing gets selected although
> SelectionXML obviously is there?
> 
> 
> 
> 
> 
> 

Argh, problem solved :)

I was sending EscapeForHtml($selection->ToXml(), true); to above script,
when I should send just $selectionXml.

Works lika a charm.



-- 
View this message in context: http://www.nabble.com/Problems-with-SetSelectionXML-tp18810301p18810885.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list