1

I am trying to add a layer to an ESRI ArcGIS Javascript API map using a WFS based on geoserver. The back end is pulling from POSTGIS, if it makes a difference. The WFS appears to work fine in openlayers, but not in the esri javascript api. Looking at the http requests, they are totally different. Specifically the GetFeatures Request. In openlayers this is the request:

[URL]:8080/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=conryservices:zip_polygons&outputFormat=text/javascript&format_options=callback:loadFeatures&srsname=EPSG:3857&bbox=-8913168.994277833,5390950.7308969125,-8903385.05465733,5400734.670517415,EPSG:3857&_=1469810854811

With a nice json response. ESRI requires me to use their proxy, but even still , the request is a POST and looks like this:

[URL]/sproxy/proxy.php?[URL]:8080/geoserver/wfs

<?xml version='1.0' encoding='utf-8'?>
<GetFeature 
 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
 xmlns:gml='http://www.opengis.net/gml'
 xmlns:ogc='http://www.opengis.net/ogc'
 xmlns:wfs='http://www.opengis.net/wfs'
 xmlns='http://www.opengis.net/wfs'
 xmlns:conryservices='[URL]'
 version='1.1.0' service='WFS' maxFeatures='100'>
 <wfs:Query typeName='conryservices:zip_polygons' srsName='EPSG:4326'>
  <ogc:Filter xmlns:ogc='http://www.opengis.net/ogc'>
   <ogc:BBOX>
    <ogc:PropertyName>conryservices:geom</ogc:PropertyName>
    <gml:Box srsName='EPSG:4326'>
      <gml:coordinates>-122.94620660400169,42.29605553470161 -122.72579339599417,42.395904817819165</gml:coordinates>
    </gml:Box>
   </ogc:BBOX>
  </ogc:Filter>
 </wfs:Query>
</GetFeature>

I'm not sure what I'm missing here, but are these running on the same standard?

  • 1
    You are aware that you require licensing to use the ESRI JSAPI, even if it is not consuming any ESRI licensed product, right? ref:developers.arcgis.com/javascript/latest/guide/licensing/… quote: If the app does not use ArcGIS Online nor ArcGIS Enterprise, you must... ...you'll have to purchase a paid ArcGIS Online Deployment Plan when you're ready to deploy your app to production (even if your app does not use ArcGIS Online data/services). – Mike Sep 11 '18 at 14:42
  • @mike I did not know that. Any idea when they started doing this? – Frank Conry Sep 12 '18 at 15:16
0

I got this to work. Here is how:

1) Forget the proxy, add you url to the esri corsEnabledServers like this:

esriConfig.defaults.io.corsEnabledServers.push([URL]:[PORT]);

notice that you need to include the port of it's non standard (cause geoserver usually uses 8080 that's not that of an unusual case)

2) For whatever reason, not sure if this is ESRI or geoserver using WFS version 1.0.0 works but using 1.1.0 does not. Both geoserver and the esri javascript API claim to support 1.1.0, so not sure what the deal is there.

That should make this work. That said I have to add a word of caution. The whole point of using a WFS instead of another solution like WMS or WCS is to access features, not tiles. ESRI's WFS layer doesn't inherit from ESRI's FeatureLayer so its functionality is very limited. I will be posting another question on using attribute based renderers, but I fear it may not be supported.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.