Has support for this been built into a latest SWC component? I can
manually style my polylines when attempting to render them on my map
but I need to get pass-through styling working (where style changes in
the hosted file manifest in my dynamic map)
Here's my StyleMap from my KML file:
<StyleMap id="m_ylw-pushpin">
<Pair>
<key>normal</key>
<styleUrl>#s_ylw-pushpin</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#s_ylw-pushpin_hl</styleUrl>
</Pair>
</StyleMap>
<Style id="s_ylw-pushpin_hl">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</
href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LineStyle>
<color>ff0000ff</color>
<width>2.2</width>
</LineStyle>
</Style>
<Style id="s_ylw-pushpin">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</
href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LineStyle>
<color>ff0000ff</color>
<width>2.2</width>
</LineStyle>
</Style>
and here's one of my features from my kml file
<Placemark>
<name>MEM-12F - 651 Whitney</name>
<description></description>
<styleUrl>#m_ylw-pushpin</styleUrl>
<LineString>
<extrude>1</extrude>
<tessellate>1</tessellate>
<coordinates>
-90.04272599999999,35.205727,0 -90.04303,35.205582,0
-90.043126,35.205558,0 </coordinates>
</LineString>
</Placemark>
I tried just ripping off the styled Polygon code and am encountering a
problem when dealing with the styles above
Here's my polylineOptions ActionScript code snippet:
if (geometry is LineString) {
var lineString:LineString = LineString(geometry);
var polylineOptions:PolylineOptions = new PolylineOptions({
strokeStyle: {color: 0xff0000ff}
});
if (styleURL) {
styleURL = styleURL.replace("#", "");
if (kmlStyles[styleURL]) {
var style:Style = kmlStyles[styleURL];
polylineOptions.strokeStyle = new StrokeStyle();
polylineOptions.strokeStyle.thickness =
style.lineStyle.width;
//this isn't working yet :(
//polylineOptions.strokeStyle.color =
style.lineStyle.color;
polylineOptions.strokeStyle.color = "ff0000ff";
}
}
var polyline:Polyline = new Polyline(getCoordinatesLatLngs
(lineString.coordinates), polylineOptions);
the styleURL above is the third parameter in the
associateGeometryWithMap method
and is passed in as
placemark.styleUrl
Can anyone assist? Am I getting problems because a StyleMap is used
for highlight vs non?
thanks
g
On Mar 29, 5:08 pm, Amit Pal <[email protected]> wrote:
> Never knew about QName before. This works fine :-)
>
> Thanks,
> Amit
>
> On Sun, Mar 29, 2009 at 10:50 AM, pamela fox <[email protected]> wrote:
> > Hey folks-
> > I'm looking into this now. The correct way to look for attributes inside a
> > namespace appears to be:
>
> > var idQN:QName = new QName(kml, "id");
> > this._id = ParsingTools.nullCheck(this.x.attribute(idQN));
>
> > More information is in the reference:
>
> >http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/XML.html#at...()<http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/XML.html#at...>
>
> > The most flexible method is to just look for the attribute without any
> > namespace- it looks like that will always find it.
>
> > I'll post a new version of KMLParser soon that contains this and other
> > fixes.
> > - pamela
>
> > On Tue, Mar 17, 2009 at 2:56 AM, cyrt <[email protected]> wrote:
>
> >> I just had the same problem with the style-id and apparently changing
> >> the code to "x...@id " solves it. Is it ok to change the code without
> >> having to deal with any unexpected errors?
>
> >> On Mar 14, 12:21 am, Amit Pal <[email protected]> wrote:
> >> > I think this is the correct syntax but it didn't work either:
>
> >> > *this...@kml::id*
>
> >> > My XML looks like:
>
> >> > <kml xmlns="http://earth.google.com/kml/2.2">
> >> > <Document>
> >> > <name>WeatherAlerts.kml</name>
> >> > <Style id="FloodAdvisory">
> >> > <IconStyle>
> >> > <color>00FF99</color>
> >> > </IconStyle>
> >> > </Style>
> >> > <Style id="Special Weather Statement">
> >> > <IconStyle>
> >> > <color>FFCC99</color>
> >> > </IconStyle>
> >> > </Style>
> >> > <Folder>
> >> > <name>Flood Advisory</name>
> >> > <Placemark>
> >> > <name>Flood</name>
> >> > <description><![CDATA[ <title>San Bernardino, Riverside
> >> > Counties (California)</title><html><b>Effective: </b>Mon Mar 9 11:19:21
> >> > GMT-0700 2009<b>Expire: </b>Tue Mar 10 11:19:21 GMT-0700
> >> 2009<b>Severity:
>
> >> </b>Extreme<b>Certainty:</b>Observed<b>County:</b>RIVERSIDE</html>]]></description>
> >> > <styleUrl>#FloodAdvisory</styleUrl>
> >> > <Point>
> >> > <coordinates> -121.60,38.7,0 </coordinates>
> >> > </Point>
> >> > </Placemark>
> >> > </Folder>
> >> > <Folder>
> >> > <name>Special Weather Statement</name>
> >> > <Placemark>
> >> > <name>Statement</name>
> >> > <styleUrl>#Special Weather Statement</styleUrl>
> >> > <description><![CDATA[<title>Some title</title><html>
> >> > <b>HTML text here</b></html>]]></description>
> >> > <Point>
> >> > <coordinates>-117.13,32.82,0 </coordinates>
> >> > </Point>
> >> > </Placemark>
> >> > </Folder>
> >> > </Document>
> >> > </kml>
>
> >> > On Fri, Mar 13, 2009 at 3:06 PM, Amit Pal <[email protected]>
> >> wrote:
> >> > > Hi Pamela,
>
> >> > > Looks like I can't access attribute from a namespace qualified
> >> expression:
>
> >> > > this.x.kml::@id -- is syntactically wrong
>
> >> > > this.x.kml::x...@id -- doesn't returns anything
>
> >> > > x...@id -- This works
>
> >> > > Should I use the last one?
>
> >> > > Thanks,
> >> > > Amit
>
> >> > > On Fri, Mar 13, 2009 at 2:05 PM, pamela fox <[email protected]>
> >> wrote:
>
> >> > >> Hi Amit-
>
> >> > >> I looked into it, and you are correct.
>
> >> > >> The fix should be to change the following in KMLObject.as (adding the
> >> > >> "@" symbol):
> >> > >> public function KmlObject(x:XMLList)
> >> > >> {
> >> > >> super(x);
> >> > >> this._id =
> >> ParsingTools.nullCheck(this.x.kml::@id
> >> > >> );
> >> > >> }
>
> >> > >> If you'd like, send me the KML file you're working with and I'll use
> >> > >> it to make a demo with id/style.
> >> > >> Sorry for the confusion.
>
> >> > >> - pamela
>
> >> > >> On Fri, Mar 13, 2009 at 8:29 AM, Amit Pal <[email protected]>
> >> > >> wrote:
> >> > >> > Hi Pamela,
>
> >> > >> > Thanks for adding styleUrl. I tried it but still the 'id' is NULL.
>
> >> > >> > Looks like the parser can't extract attribute 'id' of the <Style>
> >> > >> element.
> >> > >> > KMLObject expects 'id' to be an element.
>
> >> > >> > Please let me know if my understanding is correct?
>
> >> > >> > -Amit
>
> >> > >> > On Sun, Mar 8, 2009 at 4:35 AM, pamela fox <[email protected]>
> >> > >> wrote:
>
> >> > >> >> Hi Amit-
>
> >> > >> >> The 'id' in Style is inherited from KMLObject, so that is there.
> >> I've
> >> > >> >> just added support for styleUrl to the Feature class, it's in the
> >> > >> >> latest download and revision.
>
> >> > >> >> Cecil is working on a demo of the features he added. "Style" in
> >> KML
> >> > >> >> crosses a lot of elements, so we likely don't have 100% support.
>
> >> > >> >> - pamela
>
> >> > >> >> On Thu, Mar 5, 2009 at 4:44 AM, Amit Pal <[email protected]
>
> >> > >> wrote:
> >> > >> >> > Thanks.Yes I saw the classes. When I was trying to use it , I
> >> > >> couldn't
> >> > >> >> > find
> >> > >> >> > a placeholder for styleUrl in the Placemark and 'id' in the
> >> 'Style'.
> >> > >> Is
> >> > >> >> > it
> >> > >> >> > still under development and somebody working on an example?
>
> >> > >> >> > -Amit
>
> >> > >> >> > On Wed, Mar 4, 2009 at 6:28 AM, pamela fox <
> >> [email protected]>
> >> > >> wrote:
>
> >> > >> >> >> Yes, Cecil added support. There's no demo for it yet, but the
> >> parser
> >> > >> >> >> classes are there.
>
> >> > >> >> >> - pamela
>
> >> > >> >> >> On Tue, Mar 3, 2009 at 2:18 PM, Pal <[email protected]>
> >> > >> wrote:
>
> >> > >> >> >> > Hi,
>
> >> > >> >> >> > Has anybody added support for <Style> in the KMLParser
> >> utility?
>
> >> > >> >> >> > -Amit
>
> >> > >> >> >> --
> >> > >> >> >> ----------------------------
> >> > >> >> >> "if you can imagine it, you can do it"
> >> > >> >> >>http://imagine-it.org
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---