[mapguide-users] Problem whit generate kml from mapguide.

Traian Stanev traian.stanev at autodesk.com
Tue Jan 22 10:54:58 EST 2008


I don't think the filter fallback you mention (used only when redering) is causing the problem of being unable to tell how many rings make up a multi-polygon when using the feature service API, which is what Maciej seems to be asking.

Maciej, did you also try iterating over the interior rings, using GetInteriorRingCount() and GetInteriorRing(). Even though the polygon is made up of two outer rings, it is possible that in the data source it is described as a Polygon, in which case the second ring would have to necessarily be put in the InteriorRings collection.

Traian



From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Zac Spitzer
Sent: Tuesday, January 22, 2008 10:09 AM
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] Problem whit generate kml from mapguide.

Mapguide currently does this stupid silent fall back and returns whole featuresource without the
filter if the filter fails.....which would explain this, unpredictably frustrating huh?

z
On Jan 23, 2008 1:57 AM, Maciej Skorczewski <maciej.skorczewski at procad.pl<mailto:maciej.skorczewski at procad.pl>> wrote:
Hi!

I wrote aplication who generate kml files.

all work fine but i have problem whit some polygons (and use API to get
coords of this polygon)

some screenshot
http://img179.imageshack.us/img179/1966/41289677tu3.png

The problem is: when i try to get coords of polygon nr.1 (in this place
 are two object-polygon in one source after use filter guery)

ex. i use
$featureReader->ReadNext() ...and MG show me 2 polygons

(1 polygon)
++++++
++++++

(second polygon)
======
======


can't get any coords of this.



the code is
______________

$featureService =
$siteConnection->CreateService(MgServiceType::FeatureService);
$queryOptions = new MgFeatureQueryOptions();
$queryOptions->SetFilter("FID > 253");
$featureReader = $featureService->SelectFeatures(new
MgResourceIdentifier($x_adress),$x_layer, $queryOptions);

       $geometryReaderWriter = new MgAgfReaderWriter();

//
// this is loop on FID > 1(next are 2,3,4,...)
//
//
       while ($featureReader->ReadNext())
       {
               $muniName = $featureReader->$a7_1($a7_0);
               $byteReader = $featureReader->GetGeometry('Geometry');
               $geometry = $geometryReaderWriter->Read($byteReader);
               $point = $geometry->GetCentroid();
               $x = $point->GetCoordinate()->GetX();
               $y = $point->GetCoordinate()->GetY();
               echo '<Placemark>';

//
// This can be a bug...
// question: how to know that there are 2 object-polygon
// and $linearRing get coords of first the second, polygon object.
//
//
               $linearRing = $geometry->GetExteriorRing();
               $coordIter = $linearRing->GetCoordinates();
               echo'<MultiGeometry>';
               echo'<Polygon>';
               echo'<outerBoundaryIs>';
               echo'<LinearRing>';
               echo'<coordinates>';
//
// So when loop is in 1. iterate it show 2 object polygons.
// ...and MG don't show any coords
//

               while ($coordIter->MoveNext())
               {
                       $coord = $coordIter->GetCurrent();
                       if ($coord != null)
                       {
                        $coord->GetX().",".$coord->GetY().",0 ";
                       }
               }
               echo'</coordinates>';
               echo'</LinearRing>';
               echo'</outerBoundaryIs>';
               echo'</Polygon>';
               echo'</MultiGeometry></Placemark>';

       }
       $featureReader->Close();
       echo '</Document></kml>';



thx for any help.
maciek
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org<mailto:mapguide-users at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/mapguide-users



--
Zac Spitzer -
http://zacster.blogspot.com (My Blog)
+61 405 847 168
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080122/ac697a0e/attachment.html


More information about the mapguide-users mailing list