Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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({
                                'internalProjection': new OpenLayers.Projection("EPSG:4326"),
                                'externalProjection': new OpenLayers.Projection("EPSG:4326")

                        return format.write(feature);

After i use this library to save file

                            filename: function(){
                                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};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.

share|improve this question
up vote 1 down vote accepted

Keep in mind that by using Downloadify, your download will not work on mobile devices and pads. This is because Downloadify relies on flash and flash is dead. iPhones and iPads never supported it and now google has removed it from their play market.

I would write a handler in your back-end language of choice. Very easy, straight forward, and works everywhere.



Looks like there's a new way to do this client side. Please note the browser support.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.