Add WFS layer from GeoServer

1342
3
Jump to solution
04-27-2020 10:02 AM
ViníciusCosta
New Contributor III

Hello, I've been trying to create a sample application that uses a WFS layer from a locally hosted GeoServer but I can't figure it out how to do it.

I managed to use a WMS service with the following code: 

   WmsLayer {
          url: "http://localhost:8080/geoserver/wms"
           layerNames: ["Test:tbl_furos_coordenadas_2"]
          }

And I've tried this to WFS but to no avail:

 FeatureLayer{
                id: gtLayer
                name: "Test"
                WfsFeatureTable {
                    id: gtTable
                    url:"http://localhost:8080/geoserver/Test/wfs"
                    tableName: "tbl_furos_coordenadas_2"
                    featureRequestMode: Enums.FeatureRequestModeManualCache
                    onLoadStatusChanged: {
                        if (loadStatus !== Enums.LoadStatusLoaded)
                            return;
                        populateWfsFeatureTable();
                    }
                }

But nothing happens. Is there something I'm missing?

0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

did you try out this sample? arcgis-runtime-samples-qt/DisplayWfsLayer.qml at master · Esri/arcgis-runtime-samples-qt · GitHub 

if you swap out the url and tableName, it should work. If it doesn't perhaps the URL is formatted wrong? I also notice you are setting the FeatureLayer.name property, but that is read-only (LayerContent QML Type | ArcGIS for Developers )

Can you connect to the errorChanged signal and see if you get any errors:

WfsFeatureTable {
    onErrorChanged: {
        console.log(error.message, error.additionalMessage);
    }
}

FeatureLayer {
    onErrorChanged: {
        console.log(error.message, error.additionalMessage);
    }
}

View solution in original post

3 Replies
LucasDanzinger
Esri Frequent Contributor

did you try out this sample? arcgis-runtime-samples-qt/DisplayWfsLayer.qml at master · Esri/arcgis-runtime-samples-qt · GitHub 

if you swap out the url and tableName, it should work. If it doesn't perhaps the URL is formatted wrong? I also notice you are setting the FeatureLayer.name property, but that is read-only (LayerContent QML Type | ArcGIS for Developers )

Can you connect to the errorChanged signal and see if you get any errors:

WfsFeatureTable {
    onErrorChanged: {
        console.log(error.message, error.additionalMessage);
    }
}

FeatureLayer {
    onErrorChanged: {
        console.log(error.message, error.additionalMessage);
    }
}
ViníciusCosta
New Contributor III

Sorry for the late answer, I'm gonna try this, thank you.

0 Kudos
ViníciusCosta
New Contributor III

We're not using it anymore so I'm not in need of this right now. Thank you for your help!

0 Kudos