Prevent Z to be undefined in 3D WFS transactions

For newly created points, Z can be undefined. In these cases, we use 0
for Z.
This commit is contained in:
Julien Enselme
2017-04-07 10:58:57 +02:00
parent 870bc51ad9
commit 4955097a52
2 changed files with 9 additions and 3 deletions

View File

@@ -471,7 +471,9 @@ ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName, opt_is3D) {
point[0] + ',' + point[1] :
point[1] + ',' + point[0]);
if (opt_is3D) {
coords += ',' + point[2];
// For newly created points, Z can be undefined.
var z = point[2] || 0;
coords += ',' + z;
}
return coords;

View File

@@ -580,7 +580,9 @@ ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
coords = (point[1] + ' ' + point[0]);
}
if (is3D) {
coords += ' ' + point[2];
// For newly created points, Z can be undefined.
var z = point[2] || 0;
coords += ' ' + z;
}
ol.format.XSD.writeStringTextNode(node, coords);
};
@@ -602,7 +604,9 @@ ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName, opt_is3D) {
point[0] + ' ' + point[1] :
point[1] + ' ' + point[0]);
if (opt_is3D) {
coords += ' ' + point[2];
// For newly created points, Z can be undefined.
var z = point[2] || 0;
coords += ' ' + z;
}
return coords;