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 <<a href="mailto:maciej.skorczewski@procad.pl">maciej.skorczewski@procad.pl</a>> 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> are two object-polygon in one source after use filter guery)<br><br>ex. i use
<br>$featureReader->ReadNext() ...and MG show me 2 polygons<br><br>(1 polygon)<br>++++++<br>++++++<br><br>(second polygon)<br>======<br>======<br><br><br>can't get any coords of this.<br><br><br><br>the code is<br>
______________<br><br>$featureService =<br>$siteConnection->CreateService(MgServiceType::FeatureService);<br>$queryOptions = new MgFeatureQueryOptions();<br>$queryOptions->SetFilter("FID > 253");<br>$featureReader = $featureService->SelectFeatures(new
<br>MgResourceIdentifier($x_adress),$x_layer, $queryOptions);<br><br> $geometryReaderWriter = new MgAgfReaderWriter();<br><br>//<br>// this is loop on FID > 1(next are 2,3,4,...)<br>//<br>//<br> while ($featureReader->ReadNext())
<br> {<br> $muniName = $featureReader->$a7_1($a7_0);<br> $byteReader = $featureReader->GetGeometry('Geometry');<br> $geometry = $geometryReaderWriter->Read($byteReader);
<br> $point = $geometry->GetCentroid();<br> $x = $point->GetCoordinate()->GetX();<br> $y = $point->GetCoordinate()->GetY();<br> echo '<Placemark>';
<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> $linearRing = $geometry->GetExteriorRing();
<br> $coordIter = $linearRing->GetCoordinates();<br> echo'<MultiGeometry>';<br> echo'<Polygon>';<br> echo'<outerBoundaryIs>';
<br> echo'<LinearRing>';<br> echo'<coordinates>';<br>//<br>// So when loop is in 1. iterate it show 2 object polygons.<br>// ...and MG don't show any coords<br>
//<br><br> while ($coordIter->MoveNext())<br> {<br> $coord = $coordIter->GetCurrent();<br> if ($coord != null)<br> {
<br> $coord->GetX().",".$coord->GetY().",0 ";<br> }<br> }<br> echo'</coordinates>';<br> echo'</LinearRing>';
<br> echo'</outerBoundaryIs>';<br> echo'</Polygon>';<br> echo'</MultiGeometry></Placemark>';<br><br> }<br> $featureReader->Close();
<br> echo '</Document></kml>';<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