Hexagon Geospatial
MENU

WebGIS

Need a push in the right direction when configuring WebMap, Portal or SDI services? Looking for hints and tips, or just looking for Ideas and information? The WebGIS discussion board is where you start those discussions, connect and share information.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Regular Contributor
Posts: 185
Registered: ‎08-10-2016
Accepted Solution

Loading a WFS using Javascript

Trying to load a WFS in Geospatial Portal using fiollowing function but i keep getting error: 

The remote server returned an error: (400) Bad Request.

 

function () {
        //Load WFS Layer if not already present in the legend
        $GP.legend.find({
            id: "{http://myserverIP/geoserver/Demo}boreholes"
        }, function (ret) {
            if (ret.legendItems.length > 0)
                $GP.ui.info(ret.legendItems.length);
        }, function (ret1) {
            $GP.legend.add({
                url: "http://MyServerIP/geoserver/Demo/wfs",
                definitionName: "WFS",
                ids: ["{http://MyServerIp/geoserver/Demo}boreholes"]
            }, function (result) {
                var legendItemIds = result.ids;
                $GP.legend.find({
                    id: legendItemIds.slice(-1)[0]
                }, function (ret) {
                    ret.legendItems[0].fitLayer();
                });
            });
        });
    });

The service is initialized in Geospatial portal and the layer appears in the Layers panel but not in map window. (plus it doesn't appear with it's default featuretype symbol)

 

When I register the WFS via  Data Sources => Add Data source, and specify version 1.1.0 as the prefered WFS version, i am able to display the features on map and do other stuff like queries and filters without issues. 

 

What i am not sure of is how to specify the WFS version using the above function.

Technical Evangelist
Posts: 1,063
Registered: ‎09-11-2015

Re: Loading a WFS using Javascript

Hi Elvis,

 

You should be able to use Service Quirk and force WFS version that way, using <excludeVersion>

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.