Yes,<br>I am using v. 2.7 but it's like the extractStyles attribute behaves correctly.<br>
<br>I've come to the real problem in my code: it seems like feature
attributes are not loaded from the KML file (and extractAttributes is
set to true). (I'm debugging with firebug)<br>This causes visualization
problem as I set a "loadend" event which modifies the styleMap adding a
rule based on one of the attributes. This works perfectly with the GML
format.<br>
<br>here is an excerpt of my KML file (with only 1 feature in this case):<br><br><br><br><?xml version="1.0" encoding="utf-8" ?><br><kml xmlns="<a href="http://www.opengis.net/kml/2.2" target="_blank">http://www.opengis.net/kml/2.2</a>"><br>
<Document><Folder><name><div id=":st" class="ArwC7c ckChnd">CALOPICOS</name><br><Schema name="CALOPICOS" id="CALOPICOS"><br> <SimpleField name="Name" type="string"></SimpleField><br>
<SimpleField name="Description" type="string"></SimpleField><br> <SimpleField name="COD_PRO" type="int"></SimpleField><br> <SimpleField name="NOME" type="string"></SimpleField><br>
<SimpleField name="NOME_PRO" type="string"></SimpleField><br> <SimpleField name="SIGLA_PRO" type="string"></SimpleField><br> <SimpleField name="COD_ISTAT" type="float"></SimpleField><br>
</Schema><br> <Placemark><br> <ExtendedData><SchemaData schemaUrl="#CALOPICOS"><br> <SimpleData name="COD_PRO">16</SimpleData><br> <SimpleData name="NOME">COSTA VOLPINO</SimpleData><br>
<SimpleData name="NOME_PRO">BERGAMO</SimpleData><br> <SimpleData name="SIGLA_PRO">BG</SimpleData><br> <SimpleData name="COD_ISTAT">16086</SimpleData><br>
</SchemaData></ExtendedData><br> <Polygon><outerBoundaryIs><LinearRing><coordinates>10.085200473748921,45.822892231012993,0 10.084585250268859,45.824369844126821,0 10.082453051210173,45.825119119054406,0 10.081007598805416,45.82684743097554,0 10.079839599744659,45.828613605040289,0 10.07717727161147,45.830258855140812,0 10.075010482295186,45.832070393590513,0 10.074058365470743,45.834532025789372,0 10.073265850979176,45.837262169208579,0 10.06965146883106,45.839991757279705,0 10.069422672793097,45.842248559262387,0 10.064130839354922,45.846186242510463,0 10.063978762676339,45.846484679629334,0 10.06434346681317,45.847880880744242,0 10.065628096568989,45.849984053949292,0 10.06583877006006,45.852668775022906,0 10.059618008333993,45.853626698390897,0 10.060379779795703,45.8545691964189,0 10.061666817265563,45.856798398052135,0 10.062159359739915,45.86042556732729,0 10.062166458357162,45.861136549440864,0 10.062491195614504,45.862798642438662,0 10.065108076125764,45.864151370298352,0 10.068276042583895,45.865093859662544,0 10.072075944094292,45.865310285186304,0 10.076297156735873,45.86666119250448,0 10.079277324783051,45.868118179615614,0 10.081854931270923,45.869902922584458,0 10.083140114771034,45.871807873298508,0 10.083937880830906,45.874153962689711,0 10.090736923776577,45.868904916714143,0 10.098095854836334,45.859113773118835,0 10.100973987278632,45.857677479099273,0 10.102589304925999,45.857121865281528,0 10.104952026382794,45.857639077088834,0 10.10549408372342,45.855091158649536,0 10.105693309684447,45.854094662090652,0 10.1137341462167,45.847482107958633,0 10.114255005756153,45.84534837924182,0 10.116027434531851,45.844462518344471,0 10.122735862283923,45.836476225598282,0 10.121797095471102,45.835576381034869,0 10.120717567718057,45.834317883315961,0 10.120381475009312,45.833691133795753,0 10.119058597198419,45.83249351040147,0 10.11877669773189,45.831276682048355,0 10.118713269859052,45.831002783035999,0 10.119842908081528,45.829790128259653,0 10.120160355091627,45.828927453139038,0 10.119746843183558,45.828530977131464,0 10.119565205620738,45.827097151264411,0 10.117436113711921,45.826937981496528,0 10.114963648834435,45.825459025574261,0 10.115432920583952,45.823735317328207,0 10.114350889127907,45.822251764759208,0 10.112532429508482,45.820712370359843,0 10.111123144812886,45.819110463619964,0 10.109297908149857,45.817058044204309,0 10.108380256032628,45.815572837402364,0 10.107786712642209,45.813796458819702,0 10.105413813519233,45.813810441626721,0 10.103850765681402,45.812956988036674,0 10.101945727268799,45.811076233310892,0 10.101763303405559,45.809412865143194,0 10.098657051624869,45.808088648873721,0 10.097241706756741,45.807485228316132,0 10.093045867937683,45.805500291707737,0 10.090559449954725,45.804542976919514,0 10.088601629641808,45.807842401601263,0 10.085108910653183,45.816286768196576,0 10.085674454851302,45.822370351516362,0 10.085264836458663,45.822738770296141,0 10.085200473748921,45.822892231012993,0</coordinates></LinearRing></outerBoundaryIs></Polygon><br>
<Style><LineStyle><color>ff0000ff</color></LineStyle> <PolyStyle><fill>1</fill></PolyStyle></Style><br> </Placemark><br><br></Folder></Document></kml></div>
<br><br><div class="gmail_quote">2009/2/17 Christopher Schmidt <span dir="ltr"><<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Tue, Feb 17, 2009 at 11:53:12AM +0100, Andreas Hocevar wrote:<br>
> On Tue, Feb 17, 2009 at 10:44 AM, goliah <<a href="mailto:bianchimro@gmail.com">bianchimro@gmail.com</a>> wrote:<br>
> > I'm trying to load a layer from a local file, using a GML or KML format<br>
> > based on file extension, and applying the same styleMap in both cases.<br>
> > The following code only works for GML but not for KML format.<br>
> > The var filename is the file to load and the var layertype is the extension<br>
> > of the file.<br>
> ><br>
> > Any hint?<br>
><br>
> Without knowing your KML data, my guess would be that the KML has<br>
> inline styles, which would override your styleMap.<br>
<br>
</div>Assuming you're using 2.7 though, this shouldn't be an issue with<br>
extractStyles false:<br>
<br>
<a href="http://trac.openlayers.org/ticket/1576" target="_blank">http://trac.openlayers.org/ticket/1576</a><br>
<br>
So if this is the case, then we should probably look into it and fix it.<br>
<br>
Goliah, are you using 2.7? Does this seem like it is possibly the case?<br>
<br>
Regards,<br>
<font color="#888888">--<br>
Christopher Schmidt<br>
MetaCarta<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Mauro Bianchi<br><a href="mailto:bianchimro@gmail.com">bianchimro@gmail.com</a><br><br>