[OpenLayers-Users] Invalid Argument error in IE8 when drawing point
features in AJAX application
Lothaire Ruellan
lothaire_ruellan at yahoo.fr
Sun Mar 13 13:32:38 EDT 2011
Hello,
I would kindly request some help because I have been struggling with an issue occurring only in IE8 with my code.
You can take a look at a demo page that illustrates the problem at http://www.europeontrack.com/test.html. As you’ll notice, it works fine Firefox, Chrome, Safari, but in IE8, it triggers the Javascript Error “Invalid Argument” in openlayers.js line 684, character 178.
This page begins by initializing an openlayers map object and declaring an empty cityLayer vector layer which we’ll use later to draw points.
A link “show city list” asynchronously calls http://www.europeontrack.com/cityList.html and inserts it in the DOM.
cityList.html declares an array where the names, latitudes and longitudes of a few cities are stored.
This array is then passed as argument to the showCities() function which is declared in test.html as follows:
function showCities(cities,layer) {
var pointFeatures = [] ;
for ( i = 0 ; i < cities.length ; i++) {
pointFeatures[i] = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(cities[i]['long'], cities[i]['lat']).transform(map.displayProjection,map.baseLayer.projection));
pointFeatures[i].attributes = { label: cities[i]['label'] };
}
cityLayer.addFeatures(pointFeatures);
return false ;
}
In IE8, only the first city contained in the ‘cities’ array is drawn and then the browser throws the “Invalid Argument” error.
You can take a look at my source code. I think I’ve stripped it down to the minimum. I’m stuck at this point trying to troubleshoot this issue.
Thank you in advance for your help.
Lothaire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110313/9f78e4e8/attachment.html
More information about the Users
mailing list