4

I want to remove the M and Z values of the shapefiles, which can be done by using Feature Class to Geodatabase (multiple) and choosing Disabled for M and Z values. The following picture shows the details of the step. enter image description here

I want to use arcpy to realize this step so I used Copy As Python Snippet and obtained the below code.

arcpy.FeatureClassToGeodatabase_conversion(Input_Features="LinearRef_Travis_LS;Merged_Final", Output_Geodatabase="C:/Users/TL/Desktop/1031/New File Geodatabase.gdb")

The code doesn't show the part of changing the environment setting. I wonder if there is way to remove the M and Z values of shapefiles by using arcpy?

I am using ArcGIS Desktop 10.3.1 Advanced License.

1 Answer 1

8

There aren't any settings in the tool that allow you to set the environment. However, looking at the documentation for this tool, you can see that the environments for M and Z values are honoured.

Prior to running your tool, set the appropriate environment settings as such:

import arcpy

# Set the outputMFlag environment to Disabled
arcpy.env.outputMFlag = "Disabled"

# Set the outputZFlag environment to Disabled
arcpy.env.outputZFlag = "Disabled"

Then you can run your code to convert the feature class:

arcpy.FeatureClassToGeodatabase_conversion(Input_Features="LinearRef_Travis_LS;Merged_Final", Output_Geodatabase="C:/Users/TL/Desktop/1031/New File Geodatabase.gdb")

Here's the documentation on the "Output has M Values" flag and here's the documentation on the "Output has Z Values" flag.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.