<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 9.00.8112.16430">
<STYLE><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Bitstream Vera Sans Mono";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></STYLE>
</HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
id=MailContainerBody lang=EN-US leftMargin=0 topMargin=0 vLink=purple link=blue
CanvasTabStop="true" name="Compose message area">
<DIV><FONT size=2 face=Arial><STRONG>I tested it in IE 8 & 9, but none of
them works.</STRONG></FONT></DIV>
<DIV><FONT size=2 face=Arial><STRONG>The code for createMapFeatures() looks like
this:</STRONG></FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face="Bitstream Vera Sans Mono">function
createMapFeatures(kmlDoc){<BR> var allFeatures = new
Array();<BR> <BR> var folder =
kmlDoc.getElementsByTagName("Folder");<BR> for (var k=1;
k<folder.length; k++){<BR> var groupName =
folder[k].getElementsByTagName("name")[0].firstChild.data;<BR> <BR> if
((groups.search(/SBB/) != -1) && (groupName ==
'SBB-Maschinen')){<BR> var placemarks =
folder[k].getElementsByTagName("Placemark");<BR> for (var i=0;
i<placemarks.length; i++){<BR> var feature =
createFeatureFromPlacemark(placemarks[i],
groupName);<BR> allFeatures.push(feature);<BR> }<BR> }<BR> else
if ((groups.search(/Vanoli/) != -1) && (groupName ==
'Vanoli-Maschinen')){<BR> var placemarks =
folder[k].getElementsByTagName("Placemark");<BR> for (var i=0;
i<placemarks.length; i++){<BR> var feature =
createFeatureFromPlacemark(placemarks[i],
groupName);<BR> allFeatures.push(feature);<BR> }<BR> }<BR> else
if ((groups.search(/Meva/) != -1) && (groupName ==
'Meva-Maschinen')){<BR> var placemarks =
folder[k].getElementsByTagName("Placemark");<BR> for (var i=0;
i<placemarks.length; i++){<BR> var feature =
createFeatureFromPlacemark(placemarks[i],
groupName);<BR> allFeatures.push(feature);<BR> }<BR> }<BR> else
if ((groups.search(/Vanomag/) != -1) && (groupName ==
'VANOMAG-Maschinen')){<BR> var placemarks =
folder[k].getElementsByTagName("Placemark");<BR> for (var i=0;
i<placemarks.length; i++){<BR> var feature =
createFeatureFromPlacemark(placemarks[i],
groupName);<BR> allFeatures.push(feature);<BR> }<BR> }<BR> else
if (groups.search(/Admin/) != -1){<BR> var placemarks =
folder[k].getElementsByTagName("Placemark");<BR> for (var i=0;
i<placemarks.length; i++){<BR> var feature =
createFeatureFromPlacemark(placemarks[i],
groupName);<BR> allFeatures.push(feature);<BR> }
<BR> }<BR> <BR> }<BR> return
allFeatures;<BR>}</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial><STRONG>it calls following
function:</STRONG></FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face="Bitstream Vera Sans Mono">function
createFeatureFromPlacemark(placemark, groupName){<BR> var lonlatString =
placemark.getElementsByTagName("coordinates")[0].firstChild.data;<BR> var
lon = lonlatString.substring(0, lonlatString.indexOf(',')); <BR> var lat =
lonlatString.substring(lonlatString.indexOf(',')+1);<BR> <BR> //Daten
auslesen<BR> var machineName =
placemark.getElementsByTagName("name")[0].firstChild.data;<BR> var
timestamp =
placemark.getElementsByTagName("when")[0].firstChild.data;<BR> var lonlat =
placemark.getElementsByTagName("coordinates")[0].firstChild.data;<BR> var
voltage =
parseFloat(placemark.getElementsByTagName("Data")[2].getElementsByTagName("value")[0].firstChild.data);<BR> <BR> //Zusatzdaten
auslesen (Batterie, Tank,...)<BR> var extendedData = new
Array();<BR> var dataElements =
placemark.getElementsByTagName("Data");<BR> for (var j=0;
j<dataElements.length; j++){<BR> extendedData[j] = new
machineData(<BR> dataElements[j].getAttribute("name"),
<BR> dataElements[j].getElementsByTagName("value")[0].firstChild.data<BR> );<BR> }<BR> <BR> var
feature = new OpenLayers.Feature.Vector(<BR> new
OpenLayers.Geometry.Point (lon, lat).transform(new
OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")),
<BR> {<BR> // type: 5 + parseInt(5 *
Math.random()),<BR> label:
machineName,<BR> timestamp:
timestamp,<BR> lonlat: lonlat,<BR> group:
groupName,<BR> voltage:
voltage,<BR> extendedData:
extendedData<BR> }<BR> );<BR> return
feature;<BR>}</FONT></DIV>
<DIV style="FONT: 10pt Tahoma"><FONT face=Arial></FONT><FONT
face=Arial></FONT> </DIV>
<DIV style="FONT: 10pt Tahoma"><FONT face=Arial></FONT> </DIV>
<DIV style="FONT: 10pt Tahoma"><FONT face=Arial><STRONG>I don't think that
!isNaN() could solve the problem, since my index is a length of an array, so
actually it should always be a number.</STRONG></FONT></DIV>
<DIV style="FONT: 10pt Tahoma"><FONT face=Arial><STRONG>Any other thoughts on
this? Maybe a hint, where to search exactly when
debugging?</STRONG></FONT></DIV>
<DIV style="FONT: 10pt Tahoma"><STRONG><FONT
face=Arial></FONT></STRONG> </DIV>
<DIV style="FONT: 10pt Tahoma"><STRONG><FONT
face=Arial>Thanks!</FONT></STRONG></DIV>
<DIV style="FONT: 10pt Tahoma"><STRONG><FONT
face=Arial>/Erik</FONT></STRONG></DIV>
<DIV style="FONT: 10pt Tahoma"><FONT face=Arial></FONT> </DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><FONT face=Arial></FONT><FONT face=Arial></FONT><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A
title="mailto:vince@vvl.com STRG + Klicken, um Verknüpfung zu folgen"
href="mailto:vince@vvl.com">Vince Lotito</A> </DIV>
<DIV><B>Sent:</B> Saturday, July 02, 2011 1:14 PM</DIV>
<DIV><B>To:</B> <A title=rikner@web.de
href="mailto:rikner@web.de">rikner@web.de</A> </DIV>
<DIV><B>Subject:</B> RE: [OpenLayers-Users] OpenLayers.Layer.Vector and Internet
Explorer</DIV></DIV></DIV>
<DIV><BR></DIV>
<DIV class=WordSection1>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt">What
version of Internet explorer? IE 8 & above do have some developer
tools that will allow you to debug your code. I can’t say for sure what
the issue is without all the code, however I will say that had similar issues
with the way IE parses the features different.. what does the code for
</SPAN><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt"> var
features = createMapFeatures(kmlDoc) look like? If you are </SPAN>to
looping to create an array of features, e.g.<SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt">.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal>for (var i in features) {… <o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>then you will need to check to see if this is a valid index
something like:<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>
if (!isNaN(i)) {<o:p></o:p></P>
<P
class=MsoNormal>
// then parse
the feature…<o:p></o:p></P>
<P style="TEXT-INDENT: 0.5in" class=MsoNormal>}<o:p></o:p></P>
<P class=MsoNormal>}<o:p></o:p></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt">Hope
this helps..<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt">Vince<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"><o:p> </o:p></SPAN></P>
<DIV>
<DIV
style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<P class=MsoNormal><B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt">From:</SPAN></B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt">
openlayers-users-bounces@lists.osgeo.org
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>On Behalf Of
</B>rikner@web.de<BR><B>Sent:</B> Saturday, July 02, 2011 5:14 AM<BR><B>To:</B>
openlayers-users@lists.osgeo.org<BR><B>Subject:</B> [OpenLayers-Users]
OpenLayers.Layer.Vector and Internet Explorer<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p> </o:p></P>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">Hello
OpenLayers-Users!</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">I have some trouble
with displaying a vector-layer on a map in Internet Explorer. In Chrome and
Firefox, it works without problems but in IE, there is nothing to see except the
OSM-map.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">The Layer-Switcher
shows my map as well as the vector-layer, but as i said there is nothing to see
except the map.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">I found out, that
some people had issues similar to this and the problem was, that the code for
the vector-layer or whatever was processed too early, so they just needed to
wait until body onload.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">But this seems to
be NOT my problem, since I call my createMap()-function in init(),
which is called on body-onload.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">IE is not giving me
any error, so i also don't know where to start. It's really annoying and I would
be so glad, if you would have any hints for me.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">Here's my code, let
me know if you need more.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt">function
createMap(kmlDoc){</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt"> map
= new OpenLayers.Map({<BR> div: "map",<BR> allOverlays:
true<BR> });<BR> var osm = new
OpenLayers.Layer.OSM();</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt"> map.addControl(new
OpenLayers.Control.LayerSwitcher());<BR> map.addControl(new
OpenLayers.Control.MousePosition());<BR> </SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt"> var
defaultStyle = new OpenLayers.Style({<BR> pointRadius:
4,</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt"> fillColor:
"#ffcc66",<BR> strokeColor: "#ff9933",<BR> strokeWidth:
1,<BR> graphicZIndex: 1<BR> }); <BR> var selectStyle =
new OpenLayers.Style({<BR> pointRadius: 6,<BR> fillColor:
"#66ccff",<BR> strokeColor: "#3399ff",<BR> graphicZIndex:
2<BR> }); <BR> var myStyles = new
OpenLayers.StyleMap({<BR> "default":
defaultStyle,<BR> "select":
selectStyle<BR> });<BR> </SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt"> var
features = createMapFeatures(kmlDoc);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt"> var
machineLayer = new OpenLayers.Layer.Vector("Points", {<BR> styleMap:
myStyles,<BR> rendererOptions: {zIndexing:
true}<BR> });<BR> machineLayer.addFeatures(features);<BR> <BR> map.addLayers([osm,
machineLayer]);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt"> select
= new
OpenLayers.Control.SelectFeature(machineLayer);<BR> machineLayer.events.on({<BR> "featureselected":
onFeatureSelect,<BR> "featureunselected":
onFeatureUnselect<BR> });<BR> map.addControl(select);<BR> select.activate(); </SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt">
</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt"> suisseBounds
= new OpenLayers.Bounds(662556, 5751427, 1171817,
6076781);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Bitstream Vera Sans Mono','serif'; FONT-SIZE: 10pt"> map.zoomToExtent(suisseBounds,
false);<BR>}</SPAN><o:p></o:p></P></DIV></DIV></BODY></HTML>