I try to create kml file from features.
My code
var feature=myVecLayer.getFeatureByFid('filedata.1');
var format;
function GetKMLFromFeatures(feature) {
format = new OpenLayers.Format.KML({
'maxDepth':10,
'extractStyles':true,
'internalProjection': new OpenLayers.Projection("EPSG:4326"),
'externalProjection': new OpenLayers.Projection("EPSG:4326")
});
alert(format);
alert(format);
return format.write(feature);
}
After i use this library to save file https://github.com/dcneiner/Downloadify
Downloadify.create('downloadify',{
filename: function(){
alert("okey");
return 'kml_test.kml';
},
data: function(){
return GetKMLFromFeatures(features);
},
onComplete: function(){
alert('Your File Has Been Saved!');
},
onCancel: function(){
alert('You have cancelled the saving of this file.');
},
onError: function(){
alert('You must put something in the File Contents or there will be nothing to save!');
},
transparent: false,
swf: 'media/downloadify.swf',
downloadImage: 'images/download.png',
width: 100,
height: 30,
transparent: true,
append: false
});
But nothing heppens. If firebug i get error
TypeError: f.el is null
...tainer.id};if(f.options.enabled===false)f.enabled=false;if(f.options.transparent...
But more strange that i not get arert alert("okey");
Whats wrong? Or if someone know better way to get kml file please give me advice.