[OpenLayers-Users] specifying a Format object w/ parameters for a GML Layer

Brian Hatchl BRIAN.R.HATCHL at saic.com
Mon Oct 1 15:44:00 EDT 2007


Hey List,

So I was modifying the kml-layer-linestring.html example to load the output
of my flight track to FOSS4G exported as KML from my GPS using GPSBabel...
GPSBabel puts out KML with the 2.1 KML Namespace.

I was trying to figure out how instantiate the KML Format object with a 2.1
kmlns parameter using this syntax:

gmllayer = new OpenLayers.Layer.GML("KML", "kml/traklog.kml", {format: new
OpenLayers.Format.KML({kmlns: "http://earth.google.com/kml/2.1"})});

...but OL was throwing this error:

this.format is not a constructor

var gml = this.format ? new this.format() : new OpenLayers.Format.GML();

GML.js (line 115)


So my question is, is there a way in javascript to pass a Format class name
such as OpenLayers.Format.KML to the GML Layer constructor along with an
initialization parameter?

Or should the format parameter of the GML Layer constructor be an
instantiated Format object?  Which would require GML.js line 115 to change
like this:

var gml = this.format ? this.format : new OpenLayers.Format.GML();


thanks,
Brian



More information about the Users mailing list