[mapguide-users] GetExteriorRing error in polygons with many interior rings

Rodolfo Moreno rmoreno at voxiva.com
Fri Feb 20 18:16:21 EST 2009


I am using mapguide API for generate kml dynamically.
First I have tested with the http interface (mapagent.fcgi) using the
GETLAYERKML operation. The KML is generated and showed correctly in google
earth.
Next I did .NET code for generating kml dynamically using mapguide API. The
code works good when the features are polygons without interior ring,
however it works bad when the features are polygon with many interior rings.
The kml is generated and GE displays the kml with errors.

this is part of my code:
sb.Append("<Polygon>");
//sb.Append("<extrude>" + extrude + "</extrude>");
//sb.Append("<altitudeMode>relativeToGround</altitudeMode>");
sb.Append("<outerBoundaryIs>");
sb.Append(EmitLinearRing(polygon.GetExteriorRing(), ht));            
sb.Append("</outerBoundaryIs>");            

for (int i = 0; i < polygon.GetInteriorRingCount(); ++i)
{
  sb.Append("<innerBoundaryIs>");
  sb.Append(EmitLinearRing(polygon.GetInteriorRing(i), ht));
  sb.Append("</innerBoundaryIs>");
}
sb.Append("</Polygon>");

I was reviewing the kml generated I could realize that GetExteriorRing
method gets the coordinates of one of the interior rings and the true
EXTERIOR RING is gotten by the GetInteriorRing method, during the FOR
iteration, something like that:

<Polygon>

<outerBoundaryIs>
 <LinearRing>
   <coordinates>
   INTERIOR RING 2
   </coordinates>
 </LinearRing>
</outerBoundaryIs>

<innerBoundaryIs>

  <LinearRing>
    <coordinates>
      INTERIOR RING 1
    </coordinates>
  </LinearRing>

 <LinearRing>
  <coordinates>
    EXTERIOR RING
  </coordinates>
 </LinearRing>

 <LinearRing>
  <coordinates>
    INTERIOR RING 3
  </coordinates>
 </LinearRing>

<innerBoundaryIs>
<Polygon>

Is it an issue or maybe is there any error in my code?
I am using MGOS 2.0.1

Regards,

-----
Rodolfo Moreno
CivilEng

-- 
View this message in context: http://n2.nabble.com/GetExteriorRing-error-in-polygons-with-many-interior-rings-tp2361862p2361862.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list