Hallo, I'm an ArcGIS Desktop 10.7 user and struggling with WFS conversion in ArcPy. When using an extent in combination with WFSToFeatureClass, it raises an error.
The documentation tells me the WFS To Feature Class conversion should work with the extent of a feature class, display or whatever:
By default all features from the WFS source are added to the feature class. The extent environment setting can be used to limit the features to just those that intersect a user-defined extent...
This example works (without the use of Extent) but returns a complete set of features:
<SPAN class="keyword token">import</SPAN> arcpy
WFS_Service <SPAN class="operator token">=</SPAN> <SPAN class="string token">"https://geodata.nationaalgeoregister.nl/cbspostcode4/wfs?&request=GetCapabilities&service=wfs"</SPAN>
WFS_FeatureType <SPAN class="operator token">=</SPAN> <SPAN class="string token">"postcode42017"</SPAN>
Out_Location <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"C:\GIS data\FGDB_datatest.gdb"</SPAN>
Out_Name <SPAN class="operator token">=</SPAN> <SPAN class="string token">"tmp2"</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>WFSToFeatureClass_conversion<SPAN class="punctuation token">(</SPAN>WFS_Service<SPAN class="punctuation token">,</SPAN> WFS_FeatureType<SPAN class="punctuation token">,</SPAN> Out_Location<SPAN class="punctuation token">,</SPAN> Out_Name<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
This example doesn't work:
<SPAN class="keyword token">import</SPAN> arcpy
fc_ext <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"C:\GIS data\FGDB_datatest.gdb\DS_datatest\test_01"</SPAN>
desc <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Describe<SPAN class="punctuation token">(</SPAN>fc_ext<SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>extent <SPAN class="operator token">=</SPAN> desc<SPAN class="punctuation token">.</SPAN>extent
WFS_Service <SPAN class="operator token">=</SPAN> <SPAN class="string token">"https://geodata.nationaalgeoregister.nl/cbspostcode4/wfs?&request=GetCapabilities&service=wfs"</SPAN>
WFS_FeatureType <SPAN class="operator token">=</SPAN> <SPAN class="string token">"postcode42017"</SPAN>
Out_Location <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"C:\GIS data\FGDB_datatest.gdb"</SPAN>
Out_Name <SPAN class="operator token">=</SPAN> <SPAN class="string token">"tmp3"</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>WFSToFeatureClass_conversion<SPAN class="punctuation token">(</SPAN>WFS_Service<SPAN class="punctuation token">,</SPAN> WFS_FeatureType<SPAN class="punctuation token">,</SPAN> Out_Location<SPAN class="punctuation token">,</SPAN> Out_Name<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
The code above raises an error saying:
ERROR 999999: Error executing function
BTW: the used extent works with a simple featureclass with points and Select_analysis.
How can I make the extent setting get to work for me???