Openlayers-5 WFS-T:格式为srsName的GML:'EPSG:4326'

时间:2019-01-11 12:36:31

标签: openlayers openlayers-5

我正在使用WFS-T实现编辑功能,我意识到当我在formatGML中使用srsName:'EPSG:3857'时,一切运行良好,但是我使用了不同的方式,例如srsName:'EPSG:EPSG:4326'我从Geoserver收到投影错误。

我的图层设置了EPSG:4326投影集。

任何人都患有adeia出了什么问题?

var formatWFS = new WFS();
var formatGML = new GML({
  featureNS: 'cesan',
  featureType: 'Escola',
  srsName: 'EPSG:4326',
  version: '1.1.0'
});

var transactWFS = function (action, feature) {

  if(feature == null)
    return;

  let node;
  switch (action) {

    case 'insert':
      feature.set('nome', 'Insert Test test test');
      node = formatWFS.writeTransaction([feature], null, null, formatGML);
      break;

    case 'update':
      feature.set('nome', 'Update Update Update Update');
      node = formatWFS.writeTransaction(null, [feature], null, formatGML);
      break;

    case 'delete':      
      node = formatWFS.writeTransaction(null, null, [feature], formatGML);
      break;
  }

  $.ajax({
    service: 'WFS',
    type: "POST",
    url: "http://localhost:8080/geoserver/cesan/wfs",
    dataType: 'xml',
    processData: false,
    contentType: 'text/xml',
    data: new XMLSerializer().serializeToString(node),

    contentType: 'text/xml',
    success: function(data) {
        console.log(formatWFS.readTransactionResponse(data));
    },
    error: function(e) {
        console.error(e);
    },
    context: this
  }).done(function() {
    vectorSource.clear();
    map.removeInteraction(draw);
    map.removeInteraction(select);
    select.getFeatures().clear();
  });
};

错误提示:

java.lang.RuntimeException: Parsing failed for Point: org.geoserver.wfs.WFSException: org.geotools.referencing.operation.projection.PointOutsideEnvelopeException: -2308718.3342682673 outside of (-180.0,180.0)

非常感谢, 沃利·门德斯(Warley Mendes)

0 个答案:

没有答案