Adds srsDimension to the pos and posList nodes when writing a WFS transaction

The WFS transaction failed if the srsDimension was not present on the
geometries.
Unit tests have been changed to accomodate the srsDimension attribute.
This commit is contained in:
Joao Gouveia
2017-08-16 10:20:22 +02:00
parent 44558b7c89
commit 5fce1b0351
9 changed files with 97 additions and 62 deletions

View File

@@ -353,7 +353,7 @@ describe('ol.format.GML3', function() {
var text =
'<gml:Point xmlns:gml="http://www.opengis.net/gml" ' +
' srsName="CRS:84">' +
' <gml:pos>1 2</gml:pos>' +
' <gml:pos srsDimension="2">1 2</gml:pos>' +
'</gml:Point>';
var g = readGeometry(format, text);
expect(g).to.be.an(ol.geom.Point);
@@ -423,7 +423,7 @@ describe('ol.format.GML3', function() {
var text =
'<gml:Point xmlns:gml="http://www.opengis.net/gml" ' +
' srsName="urn:x-ogc:def:crs:EPSG:4326">' +
' <gml:pos>2 1</gml:pos>' +
' <gml:pos srsDimension="2">2 1</gml:pos>' +
'</gml:Point>';
var g = readGeometry(formatWGS84, text);
expect(g).to.be.an(ol.geom.Point);
@@ -440,7 +440,7 @@ describe('ol.format.GML3', function() {
var text =
'<gml:LineString xmlns:gml="http://www.opengis.net/gml" ' +
' srsName="CRS:84">' +
' <gml:posList>1 2 3 4</gml:posList>' +
' <gml:posList srsDimension="2">1 2 3 4</gml:posList>' +
'</gml:LineString>';
var g = readGeometry(format, text);
expect(g).to.be.an(ol.geom.LineString);
@@ -479,7 +479,7 @@ describe('ol.format.GML3', function() {
var text =
'<gml:LineString xmlns:gml="http://www.opengis.net/gml" ' +
' srsName="urn:x-ogc:def:crs:EPSG:4326">' +
' <gml:posList>2 1 4 3</gml:posList>' +
' <gml:posList srsDimension="2">2 1 4 3</gml:posList>' +
'</gml:LineString>';
var g = readGeometry(formatWGS84, text);
expect(g).to.be.an(ol.geom.LineString);
@@ -498,7 +498,7 @@ describe('ol.format.GML3', function() {
var text =
'<gml:LineString xmlns:gml="http://www.opengis.net/gml" ' +
' srsName="urn:x-ogc:def:crs:EPSG:4326">' +
' <gml:posList>-90 -180 90 180</gml:posList>' +
' <gml:posList srsDimension="2">-90 -180 90 180</gml:posList>' +
'</gml:LineString>';
var g = readGeometry(format, text);
expect(g).to.be.an(ol.geom.LineString);
@@ -512,7 +512,7 @@ describe('ol.format.GML3', function() {
var text =
'<gml:Point xmlns:gml="http://www.opengis.net/gml" ' +
' srsName="urn:x-ogc:def:crs:EPSG:4326">' +
' <gml:pos>-90 -180</gml:pos>' +
' <gml:pos srsDimension="2">-90 -180</gml:pos>' +
'</gml:Point>';
var g = readGeometry(format, text);
expect(g).to.be.an(ol.geom.Point);
@@ -531,7 +531,8 @@ describe('ol.format.GML3', function() {
' <gml:exterior>' +
' <gml:LinearRing srsName=' +
' "urn:x-ogc:def:crs:EPSG:4326">' +
' <gml:posList>38.9661 -77.0081 38.9931 -77.0421 ' +
' <gml:posList srsDimension="2">' +
' 38.9661 -77.0081 38.9931 -77.0421 ' +
' 38.9321 -77.1221 38.9151 -77.0781 38.8861 ' +
' -77.0671 38.8621 -77.0391 38.8381 -77.0401 ' +
' 38.8291 -77.0451 38.8131 -77.0351 38.7881 ' +
@@ -575,7 +576,7 @@ describe('ol.format.GML3', function() {
var text =
'<gml:LinearRing xmlns:gml="http://www.opengis.net/gml" ' +
' srsName="CRS:84">' +
' <gml:posList>1 2 3 4 5 6 1 2</gml:posList>' +
' <gml:posList srsDimension="2">1 2 3 4 5 6 1 2</gml:posList>' +
'</gml:LinearRing>';
var g = readGeometry(format, text);
expect(g).to.be.an(ol.geom.LinearRing);
@@ -595,17 +596,17 @@ describe('ol.format.GML3', function() {
' srsName="CRS:84">' +
' <gml:exterior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>1 2 3 2 3 4 1 2</gml:posList>' +
' <gml:posList srsDimension="2">1 2 3 2 3 4 1 2</gml:posList>' +
' </gml:LinearRing>' +
' </gml:exterior>' +
' <gml:interior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>2 3 2 5 4 5 2 3</gml:posList>' +
' <gml:posList srsDimension="2">2 3 2 5 4 5 2 3</gml:posList>' +
' </gml:LinearRing>' +
' </gml:interior>' +
' <gml:interior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>3 4 3 6 5 6 3 4</gml:posList>' +
' <gml:posList srsDimension="2">3 4 3 6 5 6 3 4</gml:posList>' +
' </gml:LinearRing>' +
' </gml:interior>' +
'</gml:Polygon>';
@@ -630,17 +631,23 @@ describe('ol.format.GML3', function() {
' <gml:PolygonPatch>' +
' <gml:exterior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>1 2 3 2 3 4 1 2</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 1 2 3 2 3 4 1 2' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:exterior>' +
' <gml:interior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>2 3 2 5 4 5 2 3</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 2 3 2 5 4 5 2 3' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:interior>' +
' <gml:interior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>3 4 3 6 5 6 3 4</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 3 4 3 6 5 6 3 4' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:interior>' +
' </gml:PolygonPatch>' +
@@ -666,7 +673,7 @@ describe('ol.format.GML3', function() {
' srsName="CRS:84">' +
' <gml:segments>' +
' <gml:LineStringSegment>' +
' <gml:posList>1 2 3 4</gml:posList>' +
' <gml:posList srsDimension="2">1 2 3 4</gml:posList>' +
' </gml:LineStringSegment>' +
' </gml:segments>' +
'</gml:Curve>';
@@ -703,17 +710,17 @@ describe('ol.format.GML3', function() {
' srsName="CRS:84">' +
' <gml:pointMember>' +
' <gml:Point srsName="CRS:84">' +
' <gml:pos>1 2</gml:pos>' +
' <gml:pos srsDimension="2">1 2</gml:pos>' +
' </gml:Point>' +
' </gml:pointMember>' +
' <gml:pointMember>' +
' <gml:Point srsName="CRS:84">' +
' <gml:pos>2 3</gml:pos>' +
' <gml:pos srsDimension="2">2 3</gml:pos>' +
' </gml:Point>' +
' </gml:pointMember>' +
' <gml:pointMember>' +
' <gml:Point srsName="CRS:84">' +
' <gml:pos>3 4</gml:pos>' +
' <gml:pos srsDimension="2">3 4</gml:pos>' +
' </gml:Point>' +
' </gml:pointMember>' +
'</gml:MultiPoint>';
@@ -755,12 +762,12 @@ describe('ol.format.GML3', function() {
' srsName="CRS:84">' +
' <gml:lineStringMember>' +
' <gml:LineString srsName="CRS:84">' +
' <gml:posList>1 2 2 3</gml:posList>' +
' <gml:posList srsDimension="2">1 2 2 3</gml:posList>' +
' </gml:LineString>' +
' </gml:lineStringMember>' +
' <gml:lineStringMember>' +
' <gml:LineString srsName="CRS:84">' +
' <gml:posList>3 4 4 5</gml:posList>' +
' <gml:posList srsDimension="2">3 4 4 5</gml:posList>' +
' </gml:LineString>' +
' </gml:lineStringMember>' +
'</gml:MultiLineString>';
@@ -804,17 +811,23 @@ describe('ol.format.GML3', function() {
' <gml:Polygon srsName="CRS:84">' +
' <gml:exterior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>1 2 3 2 3 4 1 2</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 1 2 3 2 3 4 1 2' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:exterior>' +
' <gml:interior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>2 3 2 5 4 5 2 3</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 2 3 2 5 4 5 2 3' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:interior>' +
' <gml:interior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>3 4 3 6 5 6 3 4</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 3 4 3 6 5 6 3 4' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:interior>' +
' </gml:Polygon>' +
@@ -823,7 +836,9 @@ describe('ol.format.GML3', function() {
' <gml:Polygon srsName="CRS:84">' +
' <gml:exterior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>1 2 3 2 3 4 1 2</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 1 2 3 2 3 4 1 2' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:exterior>' +
' </gml:Polygon>' +
@@ -892,12 +907,12 @@ describe('ol.format.GML3', function() {
' srsName="CRS:84">' +
' <gml:curveMember>' +
' <gml:LineString srsName="CRS:84">' +
' <gml:posList>1 2 2 3</gml:posList>' +
' <gml:posList srsDimension="2">1 2 2 3</gml:posList>' +
' </gml:LineString>' +
' </gml:curveMember>' +
' <gml:curveMember>' +
' <gml:LineString srsName="CRS:84">' +
' <gml:posList>3 4 4 5</gml:posList>' +
' <gml:posList srsDimension="2">3 4 4 5</gml:posList>' +
' </gml:LineString>' +
' </gml:curveMember>' +
'</gml:MultiCurve>';
@@ -917,7 +932,7 @@ describe('ol.format.GML3', function() {
' <gml:Curve srsName="CRS:84">' +
' <gml:segments>' +
' <gml:LineStringSegment>' +
' <gml:posList>1 2 2 3</gml:posList>' +
' <gml:posList srsDimension="2">1 2 2 3</gml:posList>' +
' </gml:LineStringSegment>' +
' </gml:segments>' +
' </gml:Curve>' +
@@ -926,7 +941,7 @@ describe('ol.format.GML3', function() {
' <gml:Curve srsName="CRS:84">' +
' <gml:segments>' +
' <gml:LineStringSegment>' +
' <gml:posList>3 4 4 5</gml:posList>' +
' <gml:posList srsDimension="2">3 4 4 5</gml:posList>' +
' </gml:LineStringSegment>' +
' </gml:segments>' +
' </gml:Curve>' +
@@ -953,17 +968,23 @@ describe('ol.format.GML3', function() {
' <gml:Polygon srsName="CRS:84">' +
' <gml:exterior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>1 2 3 2 3 4 1 2</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 1 2 3 2 3 4 1 2' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:exterior>' +
' <gml:interior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>2 3 2 5 4 5 2 3</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 2 3 2 5 4 5 2 3' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:interior>' +
' <gml:interior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>3 4 3 6 5 6 3 4</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 3 4 3 6 5 6 3 4' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:interior>' +
' </gml:Polygon>' +
@@ -972,7 +993,9 @@ describe('ol.format.GML3', function() {
' <gml:Polygon srsName="CRS:84">' +
' <gml:exterior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>1 2 3 2 3 4 1 2</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 1 2 3 2 3 4 1 2' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:exterior>' +
' </gml:Polygon>' +
@@ -1041,17 +1064,23 @@ describe('ol.format.GML3', function() {
' <gml:PolygonPatch>' +
' <gml:exterior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>1 2 3 2 3 4 1 2</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 1 2 3 2 3 4 1 2' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:exterior>' +
' <gml:interior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>2 3 2 5 4 5 2 3</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 2 3 2 5 4 5 2 3' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:interior>' +
' <gml:interior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>3 4 3 6 5 6 3 4</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 3 4 3 6 5 6 3 4' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:interior>' +
' </gml:PolygonPatch>' +
@@ -1064,7 +1093,9 @@ describe('ol.format.GML3', function() {
' <gml:PolygonPatch>' +
' <gml:exterior>' +
' <gml:LinearRing srsName="CRS:84">' +
' <gml:posList>1 2 3 2 3 4 1 2</gml:posList>' +
' <gml:posList srsDimension="2">' +
' 1 2 3 2 3 4 1 2' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:exterior>' +
' </gml:PolygonPatch>' +