I have a working Export tool that grabs a published Rest service of several layers and saves them locally on my computer, the only thing I need to add to it is on the point feature classes there is no X and Y coordinates. So I have to calculate them and add them to the exported shape file. The following code WORKS PERFECT (I just left out the variables and such) but I am working on the "If it is a Point FC then add the X&Y to that exported FC. The CODE I have that is remarked out is what I am wanting to do logically but it is not correct. Can someone help with the correct syntax and calls?
with arcpy.EnvManager(preserveGlobalIds=True):
for x in data_content.layers:
if x.properties.type == "Feature Layer":
layer_name = x.properties.name.replace(" ","")
layer_url = x.url;
#if layer_url.geometry.dtype == "Point":
#Calulate/get the X & Y values
#XVALUE = arcpy.management.CalculateGeometryAttributes(arcpy.env.workspace, POINT_X)
#YVALUE = arcpy.management.CalculateGeometryAttributes(arcpy.env.workspace, POINT_Y)
#XField = arcpy.AddFieldDelimiters(arcpy.env.workspace, "X")
#YField = arcpy.AddFieldDelimiters(arcpy.env.workspace, "Y")
#expression = XField + " = XVALUE, YField + " = YVALUE,"
#arcpy.conversion.FeatureClassToFeatureClass(layer_url, workspace_gdb, layer_name, expression)
arcpy.conversion.FeatureClassToFeatureClass(layer_url, workspace_gdb, layer_name)
for x in data_content.tables:
if x.properties.type == "Table":
layer_name = x.properties.name.replace(" ","")
layer_url = x.url;
arcpy.conversion.TableToTable(layer_url, workspace_gdb, layer_name)