[OpenLayers-Users] OpenLayers.Layer.Vector and Internet Explorer

rikner at web.de rikner at web.de
Sat Jul 2 05:14:28 EDT 2011


Hello OpenLayers-Users!

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.
The Layer-Switcher shows my map as well as the vector-layer, but as i said there is nothing to see except the map.

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.
But this seems to be NOT my problem, since I call my createMap()-function in init(), which is called on body-onload.

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.

Here's my code, let me know if you need more.


function createMap(kmlDoc){

 map = new OpenLayers.Map({
  div: "map",
  allOverlays: true
 });
 var osm = new OpenLayers.Layer.OSM();
 map.addControl(new OpenLayers.Control.LayerSwitcher());
 map.addControl(new OpenLayers.Control.MousePosition());
 
 var defaultStyle = new OpenLayers.Style({
  pointRadius: 4,
  fillColor: "#ffcc66",
  strokeColor: "#ff9933",
  strokeWidth: 1,
  graphicZIndex: 1
 }); 
 var selectStyle = new OpenLayers.Style({
  pointRadius: 6,
  fillColor: "#66ccff",
  strokeColor: "#3399ff",
  graphicZIndex: 2
 }); 
 var myStyles = new OpenLayers.StyleMap({
  "default": defaultStyle,
  "select": selectStyle
 });
  
 var features = createMapFeatures(kmlDoc);

 var machineLayer = new OpenLayers.Layer.Vector("Points", {
  styleMap: myStyles,
  rendererOptions: {zIndexing: true}
 });
 machineLayer.addFeatures(features);
 
 map.addLayers([osm, machineLayer]);

 select = new OpenLayers.Control.SelectFeature(machineLayer);
 machineLayer.events.on({
  "featureselected": onFeatureSelect,
  "featureunselected": onFeatureUnselect
 });
 map.addControl(select);
 select.activate(); 
  
 suisseBounds = new OpenLayers.Bounds(662556, 5751427, 1171817, 6076781);
 map.zoomToExtent(suisseBounds, false);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110702/1fd392a4/attachment.html


More information about the Users mailing list