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

Zac Spitzer zac.spitzer at gmail.com
Tue Jan 22 10:09:08 EST 2008


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>
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
> 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/20080123/0f3fe8c1/attachment.html


More information about the mapguide-users mailing list