Mapguide currently does this stupid silent fall back and returns whole featuresource without the <br>filter if the filter fails.....which would explain this, unpredictably frustrating huh?<br><br>z<br><br><div class="gmail_quote">
On Jan 23, 2008 1:57 AM, Maciej Skorczewski &lt;<a href="mailto:maciej.skorczewski@procad.pl">maciej.skorczewski@procad.pl</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi!<br><br>I wrote aplication who generate kml files.<br><br>all work fine but i have problem whit some polygons (and use API to get<br>coords of this polygon)<br><br>some screenshot<br><a href="http://img179.imageshack.us/img179/1966/41289677tu3.png" target="_blank">
http://img179.imageshack.us/img179/1966/41289677tu3.png</a><br><br>The problem is: when i try to get coords of polygon nr.1 (in this place<br> &nbsp;are two object-polygon in one source after use filter guery)<br><br>ex. i use
<br>$featureReader-&gt;ReadNext() ...and MG show me 2 polygons<br><br>(1 polygon)<br>++++++<br>++++++<br><br>(second polygon)<br>======<br>======<br><br><br>can&#39;t get any coords of this.<br><br><br><br>the code is<br>
______________<br><br>$featureService =<br>$siteConnection-&gt;CreateService(MgServiceType::FeatureService);<br>$queryOptions = new MgFeatureQueryOptions();<br>$queryOptions-&gt;SetFilter(&quot;FID &gt; 253&quot;);<br>$featureReader = $featureService-&gt;SelectFeatures(new
<br>MgResourceIdentifier($x_adress),$x_layer, $queryOptions);<br><br> &nbsp; &nbsp; &nbsp; &nbsp;$geometryReaderWriter = new MgAgfReaderWriter();<br><br>//<br>// this is loop on FID &gt; 1(next are 2,3,4,...)<br>//<br>//<br> &nbsp; &nbsp; &nbsp; &nbsp;while ($featureReader-&gt;ReadNext())
<br> &nbsp; &nbsp; &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$muniName = $featureReader-&gt;$a7_1($a7_0);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$byteReader = $featureReader-&gt;GetGeometry(&#39;Geometry&#39;);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$geometry = $geometryReaderWriter-&gt;Read($byteReader);
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$point = $geometry-&gt;GetCentroid();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$x = $point-&gt;GetCoordinate()-&gt;GetX();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$y = $point-&gt;GetCoordinate()-&gt;GetY();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo &#39;&lt;Placemark&gt;&#39;;
<br><br>//<br>// This can be a bug...<br>// question: how to know that there are 2 object-polygon<br>// and $linearRing get coords of first the second, polygon object.<br>//<br>//<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$linearRing = $geometry-&gt;GetExteriorRing();
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$coordIter = $linearRing-&gt;GetCoordinates();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo&#39;&lt;MultiGeometry&gt;&#39;;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo&#39;&lt;Polygon&gt;&#39;;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo&#39;&lt;outerBoundaryIs&gt;&#39;;
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo&#39;&lt;LinearRing&gt;&#39;;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo&#39;&lt;coordinates&gt;&#39;;<br>//<br>// So when loop is in 1. iterate it show 2 object polygons.<br>// ...and MG don&#39;t show any coords<br>
//<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while ($coordIter-&gt;MoveNext())<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$coord = $coordIter-&gt;GetCurrent();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ($coord != null)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $coord-&gt;GetX().&quot;,&quot;.$coord-&gt;GetY().&quot;,0 &quot;;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo&#39;&lt;/coordinates&gt;&#39;;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo&#39;&lt;/LinearRing&gt;&#39;;
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo&#39;&lt;/outerBoundaryIs&gt;&#39;;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo&#39;&lt;/Polygon&gt;&#39;;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo&#39;&lt;/MultiGeometry&gt;&lt;/Placemark&gt;&#39;;<br><br> &nbsp; &nbsp; &nbsp; &nbsp;}<br> &nbsp; &nbsp; &nbsp; &nbsp;$featureReader-&gt;Close();
<br> &nbsp; &nbsp; &nbsp; &nbsp;echo &#39;&lt;/Document&gt;&lt;/kml&gt;&#39;;<br><br><br><br>thx for any help.<br>maciek<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><br></blockquote></div><br><br clear="all"><br>
-- <br>Zac Spitzer -<br><a href="http://zacster.blogspot.com">http://zacster.blogspot.com</a> (My Blog)<br>+61 405 847 168