diff --git a/lib/OpenLayers/Format/KML.js b/lib/OpenLayers/Format/KML.js
index bcef2034bc..ba612fc08b 100644
--- a/lib/OpenLayers/Format/KML.js
+++ b/lib/OpenLayers/Format/KML.js
@@ -1222,7 +1222,8 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
* {DOMElement}
*/
buildGeometryNode: function(geometry) {
- if (this.internalProjection && this.externalProjection) {
+ if (this.internalProjection && this.externalProjection &&
+ !(geometry instanceof OpenLayers.Geometry.Collection)) {
geometry = geometry.clone();
geometry.transform(this.internalProjection,
this.externalProjection);
diff --git a/tests/Format/GeoJSON.html b/tests/Format/GeoJSON.html
index f6393462df..0ee547977e 100644
--- a/tests/Format/GeoJSON.html
+++ b/tests/Format/GeoJSON.html
@@ -95,6 +95,19 @@
t.eq(data.components[1].y, 1, "y of second component is right");
}
+ function test_Format_GeoJSON_multipoint_projected(t) {
+ t.plan(1);
+ var f = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint([
+ new OpenLayers.Geometry.Point(15555162, 4247484)]));
+ var format = new OpenLayers.Format.GeoJSON({
+ internalProjection: new OpenLayers.Projection("EPSG:900913"),
+ externalProjection: new OpenLayers.Projection("EPSG:4326")
+ });
+ var data = format.write(f);
+ var found = (data.search('139.734') != -1);
+ t.ok(found, "Found 139.734 (correct reprojection) in data output.");
+ }
+
function test_Format_GeoJSON_multiline(t) {
t.plan(3);
diff --git a/tests/Format/KML.html b/tests/Format/KML.html
index 6056ee12fd..c88a39fbb0 100644
--- a/tests/Format/KML.html
+++ b/tests/Format/KML.html
@@ -9,7 +9,6 @@
var test_style_outline = ' -112,36 -113,37 ';
var test_style_font = ' -112,36 -113,37 ';
var test_nl = ' http://maker.geocommons.com/maps/1717/overlays/0 ';
-
function test_Format_KML_constructor(t) {
t.plan(5);
@@ -23,7 +22,20 @@
t.eq(format.externalProjection.getCode(), "EPSG:4326",
"default external projection is EPSG:4326");
}
-
+ function test_Format_KML_multipoint(t) {
+ t.plan(1);
+ var f = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint([
+ new OpenLayers.Geometry.Point(15555162, 4247484)]));
+ var format = new OpenLayers.Format.KML({
+ extractStyles: true,
+ extractAttributes: true,
+ internalProjection: new OpenLayers.Projection("EPSG:900913"),
+ externalProjection: new OpenLayers.Projection("EPSG:4326")
+ });
+ var data = format.write(f);
+ var found = (data.search('139.734') != -1);
+ t.ok(found, "Found 139.734 (correct reprojection) in data output.");
+ }
function test_Format_KML_read(t) {
t.plan(5);
var features = (new OpenLayers.Format.KML()).read(this.test_content);
@@ -35,6 +47,7 @@
"read geometry collection");
}
+
function test_Format_KML_readCdataAttributes_20(t) {
t.plan(2);
var cdata = ' #rel1.0 17.266666, 48.283333';