Tag Info

Hot answers tagged

11

I'm pretty sure you can do this with Feature Class to Feature Class by re-ordering fields in the field map section of the tool. Edit: FC2FC doesn't do this but...ogr to the rescue. I just confirmed that ogr2ogr can do this. Specify your field name order on the -select switch. For instance, if I have a shapefile with two fields, "Name" and "FolderPath" (in ...


3

When you bring in a csv, Arc does its best to determine the appropriate field types and as you have found it doesn't always get it right. One solution is to use a schema.ini file (see bottom of page) to explicitly set the field types for your columns. There are several related (duplicate?) questions here on the GIS SE if you search for 'schema.ini'. More ...


2

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: ...


2

Note: I've edited this answer to correct a mistake highlighted above The problem is you are removing the field map to the table, and not removing the fields from the field map. So, it removes the first (and only) fieldmap, then it doesn't know what to do when you tell it to look for the next fieldmap. What you need to do is create a new fieldmap and add ...


2

I've tried to do this with code and had a similar situation as yours. Arc kept trying to merge a text field with a integer field because the fields were named the same, even though the data type was different. Here is an example: I had to bring all the shape files I wanted to merge into the merge tool and go through the field mappings to make sure that ...


1

I dislike the ModelBuilder environment for many reasons such as this one. It has a very convoluted validation system that tends to get in the way more than it helps. I suspect it is trying to be "helpful" by noticing you updated the data source of some upstream data element and "helpfully" wipes out your field mappings. Perhaps you could export your working ...


1

I'm not sure why that isn't working for you, but why not try an additive approach instead of a removal approach (see code below). I confess I haven't tested this code to make sure it will work, but I'm pretty sure it will. EDIT: I've tested this script out on a test dataset and it works fine. I'll continue investigating what the problem is with your ...


1

You can find an interesting article from ESRI Python Team : Otherwise the "Field Mappings" are explained here (with usefull examples at the end of the page):


1

I encountered the same problem after upgrading to v10.1 for nearly the same scenario... errors on Date columns when using arcpy.FeatureClassToFeatureClass_conversion with joined layers in Python script. I'm using the following workaround: Use arcpy.FeatureClassToFeatureClass_conversion, but omit the field map parameter. I'm storing the output feature ...


1

I have had a similar issue, and the fastest way to permanently reorder data fields, if you already have QGIS, is to use the 'Table Manager' plugin as previously suggested. It is simple to install plugins and is user-friendly, as described on the page below: http://www.qgistutorials.com/en/docs/using_plugins.html It allows you to move the attributes in a ...


1

Open the .mdb file in MS Access and reorder the fields using drag and drop in 'Design View' Though ESRI discourages editing a database in Access ESRI link


1

Export the feature classes to an empty personal geodatabase (drag and drop is fastest), open the .mdb in Access, re-order the fields, then export back to shape or file geodatabase. You can use the same method to rename the fields. Be careful though, only work on copies, it is easy to screw everything up.



Only top voted, non community-wiki answers of a minimum length are eligible