Hallo,
i try to use some WFS Layers in germany-saxonia (ThinkGeo Version 14.3.1) with the following code:
string serviceLocationUrl = @"https://luis.sachsen.de/arcgis/services/luft/tierhaltung_wfs/MapServer/WFSServer";
string typeName = "tierhaltung_wfs:Tierhaltung";
wfsV2FeatureLayer layer = new WfsV2FeatureLayer()
{
WebProxy = proxy,
ServiceLocationUrl = serviceLocationUrl,
TypeName = typeName,
TimeoutInSeconds = 500
};
layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimplePointStyle(PointSymbolType.StarCircled, GeoColors.Black, 5);
layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
layer.FeatureSource.ProjectionConverter = new ProjectionConverter(sridWfs, sridView);
First, the layer will shown. But when I zoom, the WfsV2Overlay will never refreshed (see the picture). The same behavior with
string serviceLocationUrl = @"https://geoportal.umwelt.sachsen.de/arcgis/services/luft/ie_anlagenbestand_wfs/MapServer/WFSServer";
string typeName = "ie_anlagenbestand_wfs:Anlagenbestand_nach_IE-Richtlinie";
And when I try to get the Columnvalues, the Columns are created but with no Values.
var source = layer.FeatureSource;
try
{
source.Open();
var features = source.GetAllFeatures(ReturningColumnsType.AllColumns);
source.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Basically, I try to develop a module, that connects with the WFS Services and store the features in a database for offline use.
So I use WfsV2FeatureLayer as a base class and for every WFS Service that I have to use, I will develop a specialised class.
Please give me an advice, how to do that.
Regards Torsten
Ben
July 17, 2025, 1:28am
2
Hi Torsten,
Can you provide me more code snippet? For example what’re sridWfs, sridView in your code?
Thanks,
Ben
Hallo Ben,
thanks for your answer. The code is from a Wpf-Test project.
private void WfsLuisTierhaltung_Click(object sender, RoutedEventArgs e)
{
var overlay = TisWfsHelper.CreateOverlayLUISSachsenTierhaltung(NetworkTools.Proxy, 25832, 25833);
this.mapControl.Overlays.Add(overlay);
_ = this.mapControl.RefreshAsync();
this.mainWindowModel.MyOverlays.Add(new MainWindowModel.theOverlay() { IsVisible = true, MyOverlay = overlay });
}
public static TisWfsV2Overlay CreateOverlayLUISSachsenTierhaltung(IWebProxy proxy, int sridView, int sridWfs)
{
var layer = TisWfsHelper.CreateLayerLUISSachsenTierhaltung(proxy, sridView, sridWfs);
var overlay = new TisWfsV2Overlay()
{
FeatureLayer = layer,
DrawingBulkCount = 500
};
return overlay;
}
static TisWfsV2FeatureLayer CreateLayerLUISSachsenTierhaltung(IWebProxy proxy, int sridView, int sridWfs)
{
string serviceLocationUrl = @"https://luis.sachsen.de/arcgis/services/luft/tierhaltung_wfs/MapServer/WFSServer";
string typeName = "tierhaltung_wfs:Tierhaltung";
TisWfsV2FeatureLayer layer = new TisWfsV2FeatureLayer()
{
WebProxy = proxy,
ServiceLocationUrl = serviceLocationUrl,
TypeName = typeName,
TimeoutInSeconds = 500
};
layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimplePointStyle(PointSymbolType.StarCircled, GeoColors.Black, 5);
layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
layer.FeatureSource.ProjectionConverter = new ProjectionConverter(sridWfs, sridView);
var source = layer.FeatureSource;
try
{
source.Open();
var features = source.GetAllFeatures(ReturningColumnsType.AllColumns);
source.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return layer;
}
Regards Torsten
Ben
July 19, 2025, 8:32pm
4
Hi Juergen,
I found some issues in the WfsV2FeatureLayer, please pull the latest beta 14.4.0-beta046 and here are some options for you:
Use your existing code but don’t need to GetAllFeatures(), as following. This will fetch the data only for the current extent.
static WfsV2FeatureLayer CreateLayerLUISSachsenTierhaltung(IWebProxy proxy, int sridView, int sridWfs)
{
string serviceLocationUrl = @"https://luis.sachsen.de/arcgis/services/luft/tierhaltung_wfs/MapServer/WFSServer";
string typeName = "tierhaltung_wfs:Tierhaltung";
WfsV2FeatureLayer layer = new WfsV2FeatureLayer()
{
WebProxy = proxy,
ServiceLocationUrl = serviceLocationUrl,
TypeName = typeName,
TimeoutInSeconds = 500
};
layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimplePointStyle(PointSymbolType.StarCircled, GeoColors.Black, 5);
layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
layer.FeatureSource.ProjectionConverter = new ProjectionConverter(sridWfs, sridView);
return layer;
}
Call GetAllFeatures() like what you are doing now, create a new InMemoryFeatureLayer and add all the returned features to InMemoryFeatureLayer.InternalFeatures. Instead of WfsV2Overlay, add that InMemoryFeatureLayer to a LayerOverlay or FeatureLayerWpfDrawingOverlay.
Have a try and let us know if you have other questions.
Thanks,
Ben