set a default EPSG:4326 externalProjection to the KML, OSM and GPX formats. r=pgiraud (closes #2424)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9975 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -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]);
|
||||
},
|
||||
|
||||
|
||||
@@ -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]);
|
||||
},
|
||||
|
||||
|
||||
@@ -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]);
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
var gpx_data = '<?xml version="1.0" encoding="ISO-8859-1"?><gpx version="1.1" creator="Memory-Map 5.1.3.715 http://www.memory-map.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/1" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"><wpt lat="51.3697845627" lon="-0.1853562259"><name>Mark</name><sym><![CDATA[Flag]]></sym><type><![CDATA[Marks]]></type></wpt><rte><name><![CDATA[Route8]]></name><type><![CDATA[Route]]></type><rtept lat="51.3761803674" lon="-0.1829991904"><name><![CDATA[WP0801]]></name><sym><![CDATA[Dot]]></sym><type><![CDATA[Waypoints]]></type></rtept><rtept lat="51.3697894659" lon="-0.1758887005"><name><![CDATA[WP0802]]></name><sym><![CDATA[Dot]]></sym><type><![CDATA[Waypoints]]></type></rtept><rtept lat="51.3639790884" lon="-0.1833202965"><name><![CDATA[WP0803]]></name><sym><![CDATA[Dot]]></sym><type><![CDATA[Waypoints]]></type></rtept><rtept lat="51.3567607069" lon="-0.1751119509"><name><![CDATA[WP0804]]></name><sym><![CDATA[Dot]]></sym><type><![CDATA[Waypoints]]></type></rtept></rte><trk><name><![CDATA[Track]]></name><type><![CDATA[Track]]></type><trkseg><trkpt lat="51.3768216433" lon="-0.1721292044"></trkpt><trkpt lat="51.3708337670" lon="-0.1649230916"></trkpt><trkpt lat="51.3644368725" lon="-0.1736741378"></trkpt><trkpt lat="51.3576354272" lon="-0.1662595250"></trkpt></trkseg></trk></gpx>';
|
||||
|
||||
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);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
var test_nl = '<kml xmlns="http://earth.google.com/kml/2.2"> <Document> <NetworkLink> <Link> <href>http://maker.geocommons.com/maps/1717/overlays/0</href> </Link> </NetworkLink> </Document></kml>';
|
||||
|
||||
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) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
function test_Format_OSM_constructor(t) {
|
||||
t.plan(4);
|
||||
t.plan(5);
|
||||
|
||||
var options = {'foo': 'bar'};
|
||||
var format = new OpenLayers.Format.OSM(options);
|
||||
@@ -14,6 +14,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_OSM_node(t) {
|
||||
t.plan(4);
|
||||
|
||||
Reference in New Issue
Block a user