Since I renamed Polygon to KmlPolygon I also had to change some code
in the Placemark class that's why the else part was executed.
Now the Placemark is recognized but its geometry is null.

Is this due to the changed class name, or do you have any idea whats
wrong?

That's the trace output: "Placemark: Placemark:  geometry: null"


On Mar 16, 12:32 pm, cyrt <[email protected]> wrote:
> That's the output:
>
> Polygon: outerBoundaryIs: OuterBoundaryIs: Boundary Common:
> linearRing: LinearRing: Geometry: KmlObject with id: null
> coordinatesCoords
>
> On Mar 13, 10:35 pm, pamela fox <[email protected]> wrote:
>
> > Hi cyrt-
>
> > In the else, if you trace(placemark.geometry), what does it show?
>
> > - pamela
>
> > On Fri, Mar 13, 2009 at 5:54 AM, cyrt <[email protected]> wrote:
>
> > > by now creating groundoverlays and simple placemarks out of a kml file
> > > works fine, but it doesn't work for polygons. Again I compared my code
> > > to the one from the KMLParser example, but I could not find any
> > > difference (neither in the kml nor in the code).
>
> > > The placemark from the kml below is recognized as a placemark, but the
> > > following check if it is a polygon fails and therefore always the code
> > > in the else-part is executed. Do you have any idea what the problem
> > > could be?
>
> > > KML:
> > > -----------------
>
> > > <Placemark>
> > > <name>poly</name>
> > > <styleUrl>#msn_ylw-pushpin</styleUrl>
> > > <Polygon>
> > >  <tessellate>1</tessellate>
> > >  <outerBoundaryIs>
> > >        <LinearRing>
> > >          <coordinates>8.07250406876639,40.97693126116689,0
> > > 8.347650386957497,38.87420434317478,0
> > > 9.523781487367955,39.01197208941193,0
> > > 9.786842963806599,41.08001709567597,0
> > > 8.07250406876639,40.97693126116689,0</coordinates>
> > >        </LinearRing>
> > >  </outerBoundaryIs>
> > > </Polygon>
> > > </Placemark>
>
> > > Source Code
> > > -----------------
>
> > > var placemark:Placemark =
> > > com.google.maps.extras.xmlparsers.kml.Placemark::Placemark(feature);
> > > if(placemark.geometry != null)
> > > {
> > >        if (placemark.geometry is
> > > com.google.maps.extras.xmlparsers.kml.Point::Point)
> > >        {
> > >                trace("POINT");
> > >                var point: 
> > > com.google.maps.extras.xmlparsers.kml.Point::Point =
> > > com.google.maps.extras.xmlparsers.kml.Point::Point
> > > (placemark.geometry);
> > >        }
> > >        else if (placemark.geometry is LineString)
> > >        {
> > >                trace("LINESTRING");
> > >                var lineString:LineString = LineString(placemark.geometry);
> > >                obj.mapObject = new Polyline(getCoordinatesLatLngs
> > > (lineString.coordinates));
> > >        }
> > >        else if (placemark.geometry is LinearRing)
> > >        {
> > >                trace("LINEARRING");
> > >                var linearRing:LinearRing = LinearRing(placemark.geometry);
> > >                obj.mapObject = new Polyline(getCoordinatesLatLngs
> > > (linearRing.coordinates));
> > >        }
> > >        else if (placemark.geometry is KmlPolygon)
> > >        {
> > >                trace("POLYGON");
> > >                var kmlpolygon:KmlPolygon = KmlPolygon(placemark.geometry);
> > >                obj.mapObject = Polygon(getCoordinatesLatLngs
> > > (kmlpolygon.outerBoundaryIs.linearRing.coordinates));
> > >        }
> > >        else
> > >        {
> > >                trace("else..");
> > >        }
> > > }
>
> > > On Mar 10, 11:20 am, cyrt <[email protected]> wrote:
> > >> Ok, sounds good, thanks again!
>
> > >> Regarding the zip libraries: I've solved the problem in the meantime
> > >> by using nochump.
>
> > >> On Mar 10, 5:12 am, pamela fox <[email protected]> wrote:
>
> > >> > Hi cyrt-
>
> > >> > I haven't used either of those libraries. I'll ask around to see if
> > >> > other Flex developers have.
>
> > >> > The opengis namespace was created after control of KML was given over
> > >> > to OGC, the standards body. Both those namespaces refer to KML 2.2, so
> > >> > the tags supported should be the same in both.
>
> > >> > - pamela
>
> > >> > On Tue, Mar 10, 2009 at 3:09 AM, cyrt <[email protected]> wrote:
>
> > >> > > thanks a lot (also for your help with my previous problems!)
>
> > >> > > when reading a kml file I just replace the opengis with
> > >> > > earth.google.com namespace. So far everything works fine, but are
> > >> > > there any significant differences between these namespaces that could
> > >> > > lead to any problems?
>
> > >> > > Now that I am able to read KML files, I have to deal with another
> > >> > > issue:
> > >> > > These KML files are stored in a KMZ archive. As far as I know KMZ
> > >> > > files are basically similar to ZIP files. Browsing the web I came
> > >> > > across FZIP (http://codeazur.com.br/lab/fzip/) and another ZIP
> > >> > > Library (http://www.nochump.com/blog/?p=15).
>
> > >> > > Can you recommend one of these libraries for my purpose, or do know a
> > >> > > better way to get this done?
>
> > >> > > On Mar 9, 12:54 am, pamela fox <[email protected]> wrote:
> > >> > >> Hi cyrt-
>
> > >> > >> The problem is that the KMLParser uses the "earth.google.com"
> > >> > >> namespace instead of the "opengis.net" namespace. If I change your 
> > >> > >> XML
> > >> > >> to use the old namespace, the parser works. I haven't come up with 
> > >> > >> an
> > >> > >> elegant system for checking both namespaces.
>
> > >> > >> <kml xmlns="http://earth.google.com/kml/2.2";
> > >> > >> xmlns:gx="http://www.google.com/kml/ext/2.2";
> > >> > >> xmlns:atom="http://www.w3.org/2005/Atom";>
>
> > >> > >> - pamela
>
> > >> > >> On Fri, Mar 6, 2009 at 2:52 AM, cyrt <[email protected]> wrote:
>
> > >> > >> > Hi!
>
> > >> > >> > I'd like to use the KMLParser, but the kml.feature is always 
> > >> > >> > null. The
> > >> > >> > code is exactly the same as in the example, that can be found here
> > >> > >> >http://gmaps-utility-library-flash.googlecode.com/svn/trunk/examples/...
> > >> > >> > .
>
> > >> > >> > This is my KML file:
>
> > >> > >> > <kml xmlns="http://www.opengis.net/kml/2.2"; xmlns:gx="http://
> > >> > >> >www.google.com/kml/ext/2.2" 
> > >> > >> >xmlns:kml="http://www.opengis.net/kml/2.2";
> > >> > >> > xmlns:atom="http://www.w3.org/2005/Atom";>
> > >> > >> >  <GroundOverlay>
> > >> > >> >    <name>ovalay</name>
> > >> > >> >    <Icon>
> > >> > >> >      <href>files/2.jpg</href>
> > >> > >> >      <viewBoundScale>0.75</viewBoundScale>
> > >> > >> >    </Icon>
> > >> > >> >    <LatLonBox>
> > >> > >> >      <north>-13.15204151432014</north>
> > >> > >> >      <south>-13.17376840745433</south>
> > >> > >> >      <east>-72.5013090207886</east>
> > >> > >> >      <west>-72.53105986935958</west>
> > >> > >> >    </LatLonBox>
> > >> > >> >  </GroundOverlay>
> > >> > >> > </kml>
>
> > >> > >> > And this is the code:
>
> > >> > >> >                public function load(fileName:String):void
> > >> > >> >                {
> > >> > >> >                        var loader:URLLoader = new URLLoader();
> > >> > >> >                        loader.addEventListener(Event.COMPLETE, 
> > >> > >> > loadKML);
> > >> > >> >                        loader.load(new URLRequest(fileName));
>
> > >> > >> >                }
>
> > >> > >> > private function loadKML(event:Event):void
> > >> > >> >                {
>
> > >> > >> >                        var kml:Kml22 = new 
> > >> > >> > Kml22(event.target.data);
> > >> > >> >                        var rootFeature:Feature = kml.feature;
>
> > >> > >> >                        kmlObj = new Object();
>
> > >> > >> >                        if(kml.feature == null)
> > >> > >> >                        {
> > >> > >> >                                trace("KML == NULL");
> > >> > >> >                        }
>
> > >> > >> >                        kmlObj.name = rootFeature.name;
> > >> > >> >                        }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to