Geographic Information Systems Asked by Wout on August 27, 2020
My project starts from a MXD containing Query Layers. I have to prepare the data in this “MasterMXD” for use in an offline application. Working with ArcMap 10.2.1 for this project. My Python script follows a simple structure:
Here is part of my Python script:
for df in arcpy.mapping.ListDataFrames(master_mxd):
for lyr in arcpy.mapping.ListLayers(master_mxd, data_frame = df):
lyrName = lyr.name.encode("ascii", "ignore")
lyrName = lyrName.replace(" ", "")
featureLyr = arcpy.MakeFeatureLayer_management(lyr, lyrName)
arcpy.FeatureClassToFeatureClass_conversion(featureLyr, outFolder, lyrName)
The problem I am facing is that some of the layers in the MXD pass through the script without problem, while others give an error 000229:
ERROR 000229: cannot open GPL0 for the MakeFeatureLayer_management tool.
It is always the same layers that give the error.
I cannot see any differences between layers that give this error and the layers that do not give it. I did not construct the database that serves the query layers and cannot find any ‘GPL0’ anywhere. I’m puzzled!
Does anyone have an idea what is causing this ERROR 000229 showing up for some of my query layers in the MakeFeatureLayer_management tool
?
Take a look at What is a query layer?:
Query Layers behave like any other feature layer or stand-alone table, so they can be used to display data, used as input into a geoprocessing tool, or accessed programmatically using developer APIs.
That is why using it directly (as input parameter) in Feature Class to Feature Class worked (as suggested by Midavalo).
for df in arcpy.mapping.ListDataFrames(master_mxd):
for lyr in arcpy.mapping.ListLayers(master_mxd, data_frame = df):
lyrName = lyr.name.encode("ascii", "ignore")
lyrName = lyrName.replace(" ", "")
arcpy.FeatureClassToFeatureClass_conversion(lyr, outFolder, lyrName)
About the ArcPy Error 000229: Cannot open <value>
, this article lists possible causes:
- The data is inaccessible, unavailable, or invalid.
- There are unsupported data types in 64-bit background processing.
- Unsupported tools are unable to run in background processing.
- The 64-bit background geoprocessing does not have the necessary 64-bit libraries.
Answered by Andre Silva on August 27, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP