Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


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?

share|improve this question

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.

share|improve this answer
A manual select (through the tool box)does not export them either, and that is why I'm asking this question, as I need to export all the fields, even non crucial ones like OID or GID... (the addition of columns is a nice workaround, unfortunately I can't edit the SDE). – jonatr Apr 6 '11 at 12:47
Ok, how about a normal export to shapefile, Data>Export Data. This will keep all of your fields in place (as well as add an index). Then run your python scripts on shapefiles rather than features? – badkins Apr 6 '11 at 13:22
do you mean a manual Data>Export data? I'm trying to avovide this as it needs to be done to a lot of layers. If you mean a tool, what tool do you use to do that? I used to use the select tool, but that's what lead to this question. – jonatr Apr 7 '11 at 9:04
UPDATE: I tried CopyFeatures_management and it doesn't export these fields either. – jonatr Apr 7 '11 at 9:11
Yeah I meant the manual data export. There is a multiple export feature class to shapefile tool in COnversion Tools>To Shapefile, but I beleive that is going to remove the object and global ids as well (as all geoproc tools will). – badkins Apr 7 '11 at 13:00

Your Answer


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.