1

I have the function:

def copyToNewGDB(workspace,eventdataset):
    EventDataset_copy = os.path.join(workspace, "eventdatasetCopy")
    arcpy.CopyFeatures_management(eventdataset, str(workspace) + "/EventDatasetCopy" )
    eventdataset = str(workspace) + "/EventDatasetCopy"

    return eventdataset

That is used to copy features (a point dataset containg events) from one workspace (gdb) to another. I have used it many times. But when I use it on a particular dataset, the gdb that receives the copy contains an empty feature class, while it the feature class should not be empty. When I use the exact same code on another dataset there are no problems.

Ergo, the problem must be in my dataset, right? Both (the working and the non-working) point feature classes are in the same gdb. I have tried to manually copy it (using copy -data management-), that did not result in any problems. How can this function result in an empty feature class for one dataset, and run without trouble for another?

5
  • 1
    Have you checked the projections? A perennial hang-up.
    – alaybourn
    Commented Jul 3, 2017 at 11:56
  • I have not, what should I check for exactly?
    – LMB
    Commented Jul 3, 2017 at 11:56
  • 2
    Why arent you using the variable EventDataset_copy as output in Copy features
    – Bera
    Commented Jul 3, 2017 at 11:58
  • @alaybourn I changed the projection from "WGS_1984_World_Mercator" to "GCS_WGS_1984. If you provide your comment as answer I will mark it as answer, because this was the solution.
    – LMB
    Commented Jul 3, 2017 at 12:04
  • @BERA, Thank you for the improvement, that is indeed a cleaner method
    – LMB
    Commented Jul 3, 2017 at 12:05

2 Answers 2

1

I had a similar issue where I was explicitly setting the output spatial reference environment setting which caused a single feature class in my set to copy with 0 records. If I left the output spatial reference unspecified then no issues. I found that switching to Copy_management vs CopyFeatures_management resolved my problem. Copy_management must handle environment settings differently but it accomplishes a very similar thing.

0

I have always found quirks like this to be caused by projection issues. Make sure they are compatible. It could be that your feature class is projected, whereas your geodatabase is not and thus you'll need to set the Geographic Transformation environment setting or simply transform your feature class into a geographic coordinate system.

1
  • A good answer should include details about how to do what your answer suggests, and what it will do to solve the problem. Please edit your answer to include more information.
    – Midavalo
    Commented Jul 3, 2017 at 14:34

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.