AnsweredAssumed Answered

Custom parameters with WFS services (LINZ) ?

Question asked by GeoShimaNZ3 on Jul 16, 2018

I have been trying to use a public WFS service NZ Street Address Web Services and API Availability | LINZ Data Service .

My main objective is to display some point of this service on my WAB developer edition, based on bounding box using Javascript.

 

I have achieve to display the data on my map but the custom parameters seems completely ignored.

 

Here is the link from LINZ which provide a parameter to set a bounding box. https://www.linz.govt.nz/data/linz-data-service/guides-and-documentation/wfs-spatial-filtering 

 

If i only use my browser the custom parameter from LINZ works perfectly :

http://data.linz.govt.nz/services;key="the key that you can generate easily on the linz website"/wfs?service=WFS&version=2.0.0&request=GetFeature&typeNames=layer-53353&cql_filter=bbox(shape,42.436793,173.634652,-42.384224,173.727006) 

 

I also have tried to add this custom parameter "cql_filter=bbox(shape,42.436793,173.634652,-42.384224,173.727006) " in Arcgis Online map viewer too (when added "layer from web" -> "WFS OGC  web service") but it's ignored so the output data are not limited by this bounding box.

 

I have been stuck on this problem for  a while now, please if someone has a solution or has already done something similar your help will be much appreciated.

 

My JS looks like this :

esriConfig.defaults.io.corsEnabledServers.push("data.linz.govt.nz"); // supports CORS

var url = "https://data.linz.govt.nz/services;key="the key that you can generate easily on linz website"/wfs?REQUEST=GetFeature&typeNames=layer-53353&BBOX(shape,-36.764156,174.975230,-36.817467,175.023120)";

var opts = {
     customParameters : {"cql_filter":"bbox(shape,-36.764156,174.975230,-36.817467,175.023120)"},
    
     url: url,
     version: "2.0.0",
     name: "layer-53353",
     wkid: 4326,
     maxFeatures: 1000
    
  };
var mylayer = new WFSLayer();

mylayer.fromJson(opts);

var symbol = new SimpleMarkerSymbol().setColor(new esri.Color([255,0,0,0.5])); 
var renderer = new SimpleRenderer(symbol); 
mylayer.setRenderer(renderer); 

this.map.addLayer(mylayer);

Outcomes