[OpenLayers-Users] OpenLayers.LoadURL for kml file - Unhandled
request return found
ashlin
twink_1984 at yahoo.com.sg
Tue May 20 09:47:15 EDT 2008
Hi,
I would like to know if there is any limit in the kml file size or http
request object. I have tried to load a 1.5mb(9000 markers) kml file using
the methods below. It showed a javascript error popup window "Unhandled
request return found". However, it works fine when i reduced the kml file
size to around 59kb (300 markers). What could be the possible problem?
function load() {
OpenLayers.loadURL("kml/doc.kml", "", null, parseData);
}
function parseData(req) {
g = new OpenLayers.Format.KML({extractStyles: true});
features = g.read(req.responseText);
var url = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
var sz = new OpenLayers.Size(10, 17);
var calculateOffset = function(size) {
return new OpenLayers.Pixel(-(size.w/2),
-size.h);
};
var icon = new OpenLayers.Icon(url, sz, null, calculateOffset);
var countMarkers = 0;
var myArray = new Array();
for(var feat in features) {
myArray[feat] = new OpenLayers.Marker(new
OpenLayers.LonLat(features[feat].geometry.x, features[feat].geometry.y),
icon.clone());
//alert(features[feat].geometry.x);
myArray[feat].events.register("click", {'marker':myArray[feat],
'testNo':feat},
function (e) {
alert(this.testNo);
onFeatureSelect(features[this.testNo]);
//Event.stop(e);
} );
kmlLayer.addMarker(myArray[feat]);
countMarkers++;
}
alert(countMarkers);
}
ashlin
--
View this message in context: http://www.nabble.com/OpenLayers.LoadURL-for-kml-file---Unhandled-request-return-found-tp17336572p17336572.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list