WFS vector layer in Openlayers 6 is not displayed, despite no error messages

97 Views Asked by At

I am totally new to WFS, thus I am not sure what I do wrong, but my WFS vector layer doesn't show on the map. I already checked previous similar questions but I didn't find a solution.

I have a basemap showing a series of layers created from geojson files. I need to show a WFS layer created on ArcGIS with worldwide EEZ: the url I have been given is https://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer?service=wfs&request=getcapabilities.

The basic code is:

const source_eez_WMS = new ol.source.Vector({
  format: new ol.format.WFS(),
  url: function (extent) {
    return (
      'https://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer?service=wfs' +
      '&request=getcapabilities'
    );
  },
  
  format: new ol.format.WFS({
    version: '1.1.0',
  }),
  strategy: ol.loadingstrategy.bbox,
});

const layer_eez_WMS = new ol.layer.Vector({
  source: source_eez_WMS,
  visible:true
});

const view =  new ol.View({
        projection: 'EPSG:3857',
        //center: ol.proj.transform([-97.6114, 38.8403], 'EPSG:3857', 'EPSG:4326'),
        center: ol.proj.transform([0,0], 'EPSG:3857', 'EPSG:4326'),
        zoom: 0
        }); 
const map = new ol.Map({
        target: 'map',
        layers: [],
        view: view
    });
map.addLayer(ocean_map);
map.addLayer(layer_eez_WMS);

The WFS is connected correctly as I can see the xml file response, but it doesn't appear on my map (while all the ther vector geojson layers are perfectly visible).

I tried with a different wfs file from another open source, and I still have the same problem. So I imagine that I am doing something wrong, but since I have never worked with WFS files I am at loss.

The xml is as follows

<?xml version="1.0" encoding="UTF-8"?>
<wfs:WFS_Capabilities
  xmlns="http://www.opengis.net/wfs/2.0"
  xmlns:wfs="http://www.opengis.net/wfs/2.0"
  xmlns:ows="http://www.opengis.net/ows/1.1"
  xmlns:fes="http://www.opengis.net/fes/2.0"
  xmlns:eez_isra="https://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  version="2.0.0"  xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd https://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer?service=wfs%26version=2.0.0%26request=DescribeFeatureType"
>
  <ows:ServiceIdentification>
    <ows:Title>WFS</ows:Title>
    <ows:Abstract>Exclusive Economic Zones</ows:Abstract>
    <ows:Keywords>
      <ows:Keyword>ESRI()</ows:Keyword>
      <ows:Keyword>EEZ</ows:Keyword>
    </ows:Keywords>
    <ows:ServiceType>WFS</ows:ServiceType>
    <ows:ServiceTypeVersion>2.0.0</ows:ServiceTypeVersion>
    <ows:Fees></ows:Fees>
    <ows:AccessConstraints></ows:AccessConstraints>
  </ows:ServiceIdentification>
  <ows:ServiceProvider>
    <ows:ProviderName></ows:ProviderName>
    <ows:ServiceContact>
      <ows:IndividualName></ows:IndividualName>
      <ows:PositionName></ows:PositionName>
      <ows:ContactInfo>
        <ows:Phone>
          <ows:Voice></ows:Voice>
          <ows:Facsimile></ows:Facsimile>
        </ows:Phone>
        <ows:Address>
          <ows:DeliveryPoint></ows:DeliveryPoint>
          <ows:City></ows:City>
          <ows:AdministrativeArea></ows:AdministrativeArea>
          <ows:PostalCode></ows:PostalCode>
          <ows:Country></ows:Country>
          <ows:ElectronicMailAddress></ows:ElectronicMailAddress>
        </ows:Address>
        <ows:OnlineResource xlink:href="https://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer"/>
        <ows:HoursOfService></ows:HoursOfService>
        <ows:ContactInstructions></ows:ContactInstructions>
      </ows:ContactInfo>
      <ows:Role>PointofContact</ows:Role>
    </ows:ServiceContact>
  </ows:ServiceProvider>
  <ows:OperationsMetadata>
    <ows:Operation name="GetCapabilities">
      <ows:DCP>
        <ows:HTTP>
          <ows:Get xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer?"/>
          <ows:Post xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer"/>
        </ows:HTTP>
      </ows:DCP>
      <ows:Parameter name="AcceptVersions">
        <ows:AllowedValues>
          <ows:Value>1.0.0</ows:Value>
          <ows:Value>1.1.0</ows:Value>
          <ows:Value>2.0.0</ows:Value>
      </ows:AllowedValues>
      </ows:Parameter>
    </ows:Operation>
    <ows:Operation name="DescribeFeatureType">
      <ows:DCP>
        <ows:HTTP>
          <ows:Get xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer?"/>
          <ows:Post xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer"/>
        </ows:HTTP>
      </ows:DCP>
    <ows:Parameter name="outputFormat">
      <ows:AllowedValues>
        <ows:Value>text/xml; subtype=gml/3.2</ows:Value>
      </ows:AllowedValues>
    </ows:Parameter>
    </ows:Operation>
    <ows:Operation name="GetPropertyValue">
      <ows:DCP>
        <ows:HTTP>
          <ows:Get xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer?"/>
          <ows:Post xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer"/>
        </ows:HTTP>
      </ows:DCP>
      <ows:Parameter name="resolve">
        <ows:AllowedValues>
          <ows:Value>none</ows:Value>
          <ows:Value>local</ows:Value>
        </ows:AllowedValues>
      </ows:Parameter>
    </ows:Operation>
    <ows:Operation name="GetFeature">
      <ows:DCP>
        <ows:HTTP>
          <ows:Get xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer?"/>
          <ows:Post xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer"/>
        </ows:HTTP>
      </ows:DCP>
      <ows:Parameter name="resultType">
        <ows:AllowedValues>
          <ows:Value>results</ows:Value>
          <ows:Value>hits</ows:Value>
        </ows:AllowedValues>
      </ows:Parameter>
      <ows:Parameter name="outputFormat">
        <ows:AllowedValues>
          <ows:Value>GML32</ows:Value>
          <ows:Value>GML32+ZIP</ows:Value>
          <ows:Value>GML32+GZIP</ows:Value>
          <ows:Value>application/gml+xml; version=3.2</ows:Value>
          <ows:Value>GML3</ows:Value>
          <ows:Value>GML3+ZIP</ows:Value>
          <ows:Value>GML3+GZIP</ows:Value>
          <ows:Value>text/xml; subtype=gml/3.1.1</ows:Value>
          <ows:Value>GML2</ows:Value>
          <ows:Value>GML2+ZIP</ows:Value>
          <ows:Value>GML2+GZIP</ows:Value>
          <ows:Value>text/xml; subtype=gml/2.1.2</ows:Value>
          <ows:Value>GEOJSON</ows:Value>
          <ows:Value>GEOJSON+ZIP</ows:Value>
          <ows:Value>GEOJSON+GZIP</ows:Value>
          <ows:Value>ESRIGEOJSON</ows:Value>
          <ows:Value>ESRIGEOJSON+ZIP</ows:Value>
          <ows:Value>ESRIGEOJSON+GZIP</ows:Value>
          <ows:Value>KML</ows:Value>
          <ows:Value>application/vnd.google-earth.kml xml</ows:Value>
          <ows:Value>application/vnd.google-earth.kml+xml</ows:Value>
          <ows:Value>KMZ</ows:Value>
          <ows:Value>application/vnd.google-earth.kmz</ows:Value>
          <ows:Value>SHAPE+ZIP</ows:Value>
          <ows:Value>CSV</ows:Value>
          <ows:Value>CSV+ZIP</ows:Value>
          <ows:Value>CSV+GZIP</ows:Value>
          <ows:Value>Geopackage</ows:Value>
          <ows:Value>Geopackage+ZIP</ows:Value>
        </ows:AllowedValues>
      </ows:Parameter>
      <ows:Parameter name="resolve">
        <ows:AllowedValues>
          <ows:Value>none</ows:Value>
          <ows:Value>local</ows:Value>
        </ows:AllowedValues>
      </ows:Parameter>
    </ows:Operation>
    <ows:Operation name="GetGmlObject">
      <ows:DCP>
        <ows:HTTP>
          <ows:Get xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer?"/>
          <ows:Post xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer"/>
        </ows:HTTP>
      </ows:DCP>
    </ows:Operation>
    <ows:Operation name="ListStoredQueries">
      <ows:DCP>
        <ows:HTTP>
          <ows:Get xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer?"/>
          <ows:Post xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer"/>
        </ows:HTTP>
      </ows:DCP>
    </ows:Operation>
    <ows:Operation name="DescribeStoredQueries">
      <ows:DCP>
        <ows:HTTP>
          <ows:Get xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer?"/>
          <ows:Post xlink:href="http://dservices.arcgis.com/04klX6dXDLpxwyls/arcgis/services/eez_isra/WFSServer"/>
        </ows:HTTP>
      </ows:DCP>
    </ows:Operation>
    <ows:Constraint name="ImplementsBasicWFS"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="ImplementsTransactionalWFS"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="ImplementsLockingWFS"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="KVPEncoding"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="XMLEncoding"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="SOAPEncoding"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="ImplementsInheritance"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="ImplementsRemoteResolve"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="ImplementsResultPaging"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="ImplementsStandardJoins"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="ImplementsSpatialJoins"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="ImplementsTemporalJoins"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="ImplementsFeatureVersioning"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="ManageStoredQueries"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></ows:Constraint>
    <ows:Constraint name="CountDefault"><ows:NoValues/><ows:DefaultValue>3000</ows:DefaultValue></ows:Constraint>
  </ows:OperationsMetadata>
  <wfs:FeatureTypeList>
  <wfs:FeatureType>
    <wfs:Name>eez_isra:eez_isra</wfs:Name>
    <wfs:Title>eez_isra</wfs:Title>
    <wfs:DefaultCRS>urn:ogc:def:crs:EPSG::3857</wfs:DefaultCRS>
    <ows:WGS84BoundingBox>
      <ows:LowerCorner>-179.99998854 -85.56250000</ows:LowerCorner>
      <ows:UpperCorner>179.99998854 86.99400535</ows:UpperCorner>
    </ows:WGS84BoundingBox>
<MetadataURL xlink:href="https://www.arcgis.com/sharing/rest/content/items/cdb9ba8416a94c6e863c5a336e7f5da2/info/metadata/metadata.xml?format=default"/>  </wfs:FeatureType>
  </wfs:FeatureTypeList>
  <fes:Filter_Capabilities>
  <fes:Conformance>
    <fes:Constraint name="ImplementsQuery"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsAdHocQuery"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsFunctions"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsResourceId"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsMinStandardFilter"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsStandardFilter"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsMinSpatialFilter"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsSpatialFilter"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsMinTemporalFilter"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsTemporalFilter"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsVersionNav"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsSorting"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsExtendedOperators"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsMinimumXPath"><ows:NoValues/><ows:DefaultValue>TRUE</ows:DefaultValue></fes:Constraint>
    <fes:Constraint name="ImplementsSchemaElementFunc"><ows:NoValues/><ows:DefaultValue>FALSE</ows:DefaultValue></fes:Constraint>
  </fes:Conformance>
  <fes:Id_Capabilities>
    <fes:ResourceIdentifier name="fes:ResourceId"/>
  </fes:Id_Capabilities>
  <fes:Scalar_Capabilities>
    <fes:LogicalOperators/>
    <fes:ComparisonOperators>
      <fes:ComparisonOperator name="PropertyIsEqualTo"/>
      <fes:ComparisonOperator name="PropertyIsNotEqualTo"/>
      <fes:ComparisonOperator name="PropertyIsLessThan"/>
      <fes:ComparisonOperator name="PropertyIsGreaterThan"/>
      <fes:ComparisonOperator name="PropertyIsLessThanOrEqualTo"/>
      <fes:ComparisonOperator name="PropertyIsGreaterThanOrEqualTo"/>
      <fes:ComparisonOperator name="PropertyIsLike"/>
      <fes:ComparisonOperator name="PropertyIsNull"/>
      <fes:ComparisonOperator name="PropertyIsNil"/>
      <fes:ComparisonOperator name="PropertyIsBetween"/>
    </fes:ComparisonOperators>
  </fes:Scalar_Capabilities>
  <fes:Spatial_Capabilities>
    <fes:GeometryOperands xmlns:gml="http://www.opengis.net/gml" xmlns:gml32="http://www.opengis.net/gml">
      <fes:GeometryOperand name="gml:Box"/>
      <fes:GeometryOperand name="gml:Envelope"/>
      <fes:GeometryOperand name="gml:Point"/>
      <fes:GeometryOperand name="gml:LineString"/>
      <fes:GeometryOperand name="gml:LinearRing"/>
      <fes:GeometryOperand name="gml:Polygon"/>
      <fes:GeometryOperand name="gml:MultiPoint"/>
      <fes:GeometryOperand name="gml:MultiCurve"/>
      <fes:GeometryOperand name="gml:MultiSurface"/>
    </fes:GeometryOperands>
    <fes:SpatialOperators>
      <fes:SpatialOperator name="BBOX"/>
      <fes:SpatialOperator name="Equals"/>
      <fes:SpatialOperator name="Disjoint"/>
      <fes:SpatialOperator name="Intersects"/>
      <fes:SpatialOperator name="Touches"/>
      <fes:SpatialOperator name="Crosses"/>
      <fes:SpatialOperator name="Within"/>
      <fes:SpatialOperator name="Contains"/>
      <fes:SpatialOperator name="Overlaps"/>
      <fes:SpatialOperator name="Beyond"/>
      <fes:SpatialOperator name="DWithin"/>
    </fes:SpatialOperators>
  </fes:Spatial_Capabilities>
  </fes:Filter_Capabilities>
</wfs:WFS_Capabilities>
0

There are 0 best solutions below