Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

The use case is exporting a feature class via a Python script (arcgisscripting v9.3x. Only a few of the columns are needed in the result feature class.

I commonly use the fieldmappings/fieldmap objects to rename columns. The docs state that you can also use them to delete a field as the feature class is being exported. Can anyone provide an example of this?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

The last sample in the Mapping input fields to output fields help topic has a python example of removing a field from a field map. Here's the relevant code:

fieldmappings = arcpy.FieldMappings()
<snip>
fieldmappings.removeFieldMap(fieldmappings.findFieldMapIndex("TRACTCODE"))

That is for 10 but it looks like there were similar methods at 9.3: FieldMappings properties

share|improve this answer
    
I hadn't seen that method, but it is in the 9.3 object model. –  DavidF Feb 17 '11 at 15:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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