diff --git a/lib/OpenLayers/Format/GPX.js b/lib/OpenLayers/Format/GPX.js index 3866f827fc..32df4124f5 100644 --- a/lib/OpenLayers/Format/GPX.js +++ b/lib/OpenLayers/Format/GPX.js @@ -7,6 +7,7 @@ * @requires OpenLayers/Feature/Vector.js * @requires OpenLayers/Geometry/Point.js * @requires OpenLayers/Geometry/LineString.js + * @requires OpenLayers/Projection.js */ /** @@ -53,6 +54,9 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, { * this instance. */ initialize: function(options) { + // GPX coordinates are always in longlat WGS84 + this.externalProjection = new OpenLayers.Projection("EPSG:4326"); + OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); }, diff --git a/lib/OpenLayers/Format/KML.js b/lib/OpenLayers/Format/KML.js index 19c04ef51e..5046c04c60 100644 --- a/lib/OpenLayers/Format/KML.js +++ b/lib/OpenLayers/Format/KML.js @@ -11,6 +11,7 @@ * @requires OpenLayers/Geometry/Collection.js * @requires OpenLayers/Request/XMLHttpRequest.js * @requires OpenLayers/Console.js + * @requires OpenLayers/Projection.js */ /** @@ -122,6 +123,9 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, { kmlIconPalette: (/root:\/\/icons\/palette-(\d+)(\.\w+)/), straightBracket: (/\$\[(.*?)\]/g) }; + // KML coordinates are always in longlat WGS84 + this.externalProjection = new OpenLayers.Projection("EPSG:4326"); + OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); }, diff --git a/lib/OpenLayers/Format/OSM.js b/lib/OpenLayers/Format/OSM.js index e8efd71a50..899d3ed213 100644 --- a/lib/OpenLayers/Format/OSM.js +++ b/lib/OpenLayers/Format/OSM.js @@ -8,6 +8,7 @@ * @requires OpenLayers/Geometry/Point.js * @requires OpenLayers/Geometry/LineString.js * @requires OpenLayers/Geometry/Polygon.js + * @requires OpenLayers/Projection.js */ /** @@ -73,6 +74,9 @@ OpenLayers.Format.OSM = OpenLayers.Class(OpenLayers.Format.XML, { area[layer_defaults.areaTags[i]] = true; } layer_defaults.areaTags = area; + + // OSM coordinates are always in longlat WGS84 + this.externalProjection = new OpenLayers.Projection("EPSG:4326"); OpenLayers.Format.XML.prototype.initialize.apply(this, [layer_defaults]); }, diff --git a/tests/Format/GPX.html b/tests/Format/GPX.html index 09d75eae74..7bf56ec80a 100644 --- a/tests/Format/GPX.html +++ b/tests/Format/GPX.html @@ -6,7 +6,7 @@ var gpx_data = 'Mark'; function test_Format_GPX_constructor(t) { - t.plan(4); + t.plan(5); var options = {'foo': 'bar'}; var format = new OpenLayers.Format.GPX(options); @@ -15,6 +15,8 @@ t.eq(format.foo, "bar", "constructor sets options correctly"); t.eq(typeof format.read, "function", "format has a read function"); t.eq(typeof format.write, "function", "format has a write function"); + t.eq(format.externalProjection.getCode(), "EPSG:4326", + "default external projection is EPSG:4326"); } function test_Format_GPX_read(t) { t.plan(4); diff --git a/tests/Format/KML.html b/tests/Format/KML.html index 0e65d24a70..3b871475ae 100644 --- a/tests/Format/KML.html +++ b/tests/Format/KML.html @@ -10,7 +10,7 @@ var test_nl = ' http://maker.geocommons.com/maps/1717/overlays/0 '; function test_Format_KML_constructor(t) { - t.plan(4); + t.plan(5); var options = {'foo': 'bar'}; var format = new OpenLayers.Format.KML(options); @@ -19,6 +19,8 @@ t.eq(format.foo, "bar", "constructor sets options correctly"); t.eq(typeof format.read, "function", "format has a read function"); t.eq(typeof format.write, "function", "format has a write function"); + t.eq(format.externalProjection.getCode(), "EPSG:4326", + "default external projection is EPSG:4326"); } function test_Format_KML_read(t) { diff --git a/tests/Format/OSM.html b/tests/Format/OSM.html index 12f62b4443..1c3c9f9fde 100644 --- a/tests/Format/OSM.html +++ b/tests/Format/OSM.html @@ -5,7 +5,7 @@