Openlayers 3 Openlayers 3中的WFS层不工作

Openlayers 3 Openlayers 3中的WFS层不工作,openlayers-3,geoserver,Openlayers 3,Geoserver,我在Geoserver中有一个PostGIS类型的图层。我使用Openlayers 3.9.0将其添加到地图上。我的代码是基于官方的 我不太明白这段代码的作用,示例没有解释。我不知道这个url:functiontextent、resolution、projection{实际上是做什么的。另外,我是否需要设置一个单独的函数来加载函数loadFeaturesresponse{…之类的功能,或者这会自动发生 当我执行代码时,我得到http://localhost:5550/undefined 404找

我在Geoserver中有一个PostGIS类型的图层。我使用Openlayers 3.9.0将其添加到地图上。我的代码是基于官方的

我不太明白这段代码的作用,示例没有解释。我不知道这个url:functiontextent、resolution、projection{实际上是做什么的。另外,我是否需要设置一个单独的函数来加载函数loadFeaturesresponse{…之类的功能,或者这会自动发生

当我执行代码时,我得到http://localhost:5550/undefined 404找不到ol debug.js:69863 28次。ol-debug.js行是这个.xhr!sendcontent;。节点服务器在端口5550上,Geoserver在端口8080上,我在节点上设置了反向代理以避免CORS和ACAO错误

请,我需要理解和调试

谢谢

更多信息


在Geoserver中,当我选择GeoJSON预览该层时,URL是http://localhost:8080/geoserver/mymap/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=mymap:mylayer&maxFeatures=50&outputFormat=application%2Fjson. 我将此设置为vector source的URL,但仍然得到相同的错误。

您看过文档吗:?@AlvinLindstam好的,所以ol.FeatureLoader从源加载功能,但是否也将其加载到地图上?关于404错误的任何提示?再次感谢
var map = new ol.Map({...//set the map

var textent = ol.proj.transformExtent([2297128.5, 4618333, 2459120.25, 4763120], 'EPSG:900913', 'EPSG:3857');
var resolution =  map.getView().getResolution();
var  projection = ol.proj.get('EPSG:3857');

var vectorSource = new ol.source.Vector({
  format: new ol.format.GeoJSON(),
  url: function(textent, resolution, projection) {
    return 'http://localhost:8080/geoserver/mymap/wfs?&service=wfs&version=1.1.0&request=GetFeature&typeName=mymap:mylayer&outputFormat=application/json&maxFeatures=100'
  },
  strategy: ol.loadingstrategy.tile(ol.tilegrid.createXYZ({maxZoom: 20}))
});

var vector = new ol.layer.Vector({
  source: vectorSource,
  style: new ol.style.Style({
    stroke: new ol.style.Stroke({
      color: 'rgba(0, 0, 255, 1.0)',
      width: 2
    })
  })
});

map.addLayer(vector);