[GIS] Export from SDE to SHP in ArcGIS 9.3.1 – problem: not exporting all fields

arcgis-9.3pythonshapefile

I'm exporting a layer from SDE to SHP by python script, and I'm doing it in 2 phases: the first includes select by location (for picking the relevant features) and the second phase includes the Select (Analysis) tool which exports the features to the output SHP.

PROBLEM:

The Select(Analysis) tool omits fields – in my case, OBJECTID and GLOBALID – which need to be in the output. (I know it's the tool's fault because when I do a manual data>export data, it exports the fields all fine and dandy.)

Does anybody know how I can fix this?

Best Answer

You are not losing any other fields except the global and object id right? These are database fields which are not necassary to a shapefile.

Check if you do a manual Select (analysis tool) not using python, or any other geoprocessing tool. They will remove the object and global ids as well. I would create new fields in your feature class with different names and copy the ids over to that, then run your python script and see what happens. All of your fields should still be in place.

I am not positive why this happens, but my guess is that geoprocessing tools have the potential to change a feature (not as apparent in a SELECT, but think clip), so the record is no longer the same as what was in SDE and should not have the same id. Like I said, not positive on the reason, but the solution of copying your attributes into a different named field should work.

Related Question