Created
August 19, 2015 01:09
-
-
Save M-Bryant/8fe126b4be8a8a195e06 to your computer and use it in GitHub Desktop.
arcpy: get workspace from feature class, without arpy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| def get_workspace(in_feature_class): | |
| ''' Get the workspace for a feature class''' | |
| workspace = os.path.dirname(in_feature_class) | |
| if [any(ext) for ext in ('.sde', '.gdb', '.mdb') if ext in os.path.splitext(workspace)]: | |
| return workspace | |
| else: | |
| return os.path.dirname(workspace) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment