arc-utils 1.3__tar.gz → 1.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {arc_utils-1.3 → arc_utils-1.4.0}/LICENSE.txt +20 -20
- {arc_utils-1.3 → arc_utils-1.4.0}/PKG-INFO +117 -117
- {arc_utils-1.3 → arc_utils-1.4.0}/README.md +98 -98
- arc_utils-1.4.0/arc_utils/__init__.py +16 -0
- {arc_utils-1.3 → arc_utils-1.4.0}/arc_utils/_inputs.py +104 -104
- {arc_utils-1.3 → arc_utils-1.4.0}/arc_utils/aprx.py +72 -72
- {arc_utils-1.3 → arc_utils-1.4.0}/arc_utils/gdb.py +242 -214
- {arc_utils-1.3 → arc_utils-1.4.0}/arc_utils/output.py +110 -110
- {arc_utils-1.3 → arc_utils-1.4.0}/arc_utils/table.py +520 -509
- {arc_utils-1.3 → arc_utils-1.4.0}/arc_utils.egg-info/PKG-INFO +117 -117
- arc_utils-1.4.0/examples/extract-featureclass-details.py +64 -0
- {arc_utils-1.3 → arc_utils-1.4.0}/pyproject.toml +31 -31
- {arc_utils-1.3 → arc_utils-1.4.0}/setup.cfg +8 -8
- {arc_utils-1.3 → arc_utils-1.4.0}/setup.py +3 -3
- {arc_utils-1.3 → arc_utils-1.4.0}/tests/conftest.py +93 -75
- {arc_utils-1.3 → arc_utils-1.4.0}/tests/test_aprx.py +35 -35
- {arc_utils-1.3 → arc_utils-1.4.0}/tests/test_gdb.py +47 -27
- {arc_utils-1.3 → arc_utils-1.4.0}/tests/test_table.py +183 -129
- arc_utils-1.3/arc_utils/__init__.py +0 -10
- arc_utils-1.3/examples/extract-featureclass-details.py +0 -124
- {arc_utils-1.3 → arc_utils-1.4.0}/arc_utils.egg-info/SOURCES.txt +0 -0
- {arc_utils-1.3 → arc_utils-1.4.0}/arc_utils.egg-info/dependency_links.txt +0 -0
- {arc_utils-1.3 → arc_utils-1.4.0}/arc_utils.egg-info/top_level.txt +0 -0
- {arc_utils-1.3 → arc_utils-1.4.0}/tests/__init__.py +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018 Grant Herbert
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Grant Herbert
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: arc-utils
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: Python utilities for use with Esri ArcGIS Pro software
|
|
5
|
-
Author-email: Grant Herbert <gdherbert@gmail.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/gdherbert/arc_utils
|
|
8
|
-
Project-URL: Download, https://github.com/gdherbert/arc_utils/tree/1.3
|
|
9
|
-
Keywords: esri,arcpy,arcgis
|
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
|
11
|
-
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: Programming Language :: Python
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
15
|
-
Requires-Python: >=3.11
|
|
16
|
-
Description-Content-Type: text/markdown
|
|
17
|
-
License-File: LICENSE.txt
|
|
18
|
-
Dynamic: license-file
|
|
19
|
-
|
|
20
|
-
# README #
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### What is this repository for? ###
|
|
24
|
-
* A collection of (mostly) arcpy related utilities for use within ArcGIS Pro (Python 3).
|
|
25
|
-
Shortcuts for accessing elements of a map document, performing various data discovery tasks on a table or geodatabase
|
|
26
|
-
|
|
27
|
-
### How do I get set up? ###
|
|
28
|
-
|
|
29
|
-
Install from PyPI:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
pip install arc-utils
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
For local development and editable usage from clone:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
python -m pip install -e .
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
To use the utilities:
|
|
42
|
-
|
|
43
|
-
* in the python window in ArcGIS Pro
|
|
44
|
-
|
|
45
|
-
``import arc_utils as au``
|
|
46
|
-
|
|
47
|
-
* typing ``au.`` will now reveal the modules and functions available to you if you have autocomplete on
|
|
48
|
-
|
|
49
|
-
* Depends on arcpy (only available with Esri license)
|
|
50
|
-
|
|
51
|
-
### Example usage ###
|
|
52
|
-
|
|
53
|
-
``import arc_utils as au``
|
|
54
|
-
|
|
55
|
-
``tbl = au.table.TableObj(path to featureclass)``
|
|
56
|
-
|
|
57
|
-
# list all fields
|
|
58
|
-
|
|
59
|
-
``print(tbl.fields)``
|
|
60
|
-
|
|
61
|
-
``pro_doc = au.aprx.AprxObj(“CURRENT”)``
|
|
62
|
-
|
|
63
|
-
``pro_doc.maps`` >> [<arcpy._mp.Map object at 0x000001A4AECBF108>, <arcpy._mp.Map object at 0x000001A4AEBB6608>]
|
|
64
|
-
|
|
65
|
-
``pro_doc.maps[0].name`` >> ‘Map’
|
|
66
|
-
|
|
67
|
-
### Accepted Input Types ###
|
|
68
|
-
|
|
69
|
-
Most path parameters now accept:
|
|
70
|
-
|
|
71
|
-
* string path
|
|
72
|
-
* ``pathlib.Path`` / other path-like objects
|
|
73
|
-
* wrapper objects with ``.path``
|
|
74
|
-
* ArcGIS layer/table objects with ``.catalogPath`` or ``.dataSource`` (where applicable)
|
|
75
|
-
|
|
76
|
-
Invalid paths raise ``ValueError("invalid path")``.
|
|
77
|
-
|
|
78
|
-
Constructor acceptance is preserved (for example, passing path-like and wrapper objects directly to ``TableObj``, ``GDBObj``, and ``AprxObj``).
|
|
79
|
-
|
|
80
|
-
### Exporting field values to Excel ###
|
|
81
|
-
|
|
82
|
-
```python
|
|
83
|
-
import arc_utils as au
|
|
84
|
-
from openpyxl import Workbook
|
|
85
|
-
|
|
86
|
-
# Single table export with class method
|
|
87
|
-
tbl = au.table.TableObj(r"C:\path\to\featureclass")
|
|
88
|
-
wb = Workbook()
|
|
89
|
-
ws = wb.active
|
|
90
|
-
tbl.export_fields_to_worksheet(ws)
|
|
91
|
-
wb.save(r"C:\path\to\schema_values.xlsx")
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
```python
|
|
95
|
-
# Multi-layer export with module function
|
|
96
|
-
layers = [r"C:\path\to\layer1", r"C:\path\to\layer2"]
|
|
97
|
-
au.table.export_field_sets(layers, r"C:\path\to\all_layers.xlsx")
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
```python
|
|
101
|
-
# Worksheet naming behavior:
|
|
102
|
-
# use_lyr_alias=True -> prefer alias/name (human-readable)
|
|
103
|
-
# use_lyr_alias=False -> use full table path (traceable)
|
|
104
|
-
au.table.export_field_sets(layers, r"C:\path\to\all_layers.xlsx", use_lyr_alias=True)
|
|
105
|
-
au.table.export_field_sets(layers, r"C:\path\to\all_layers_by_path.xlsx", use_lyr_alias=False)
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
```python
|
|
109
|
-
# Duplicate detection outputs
|
|
110
|
-
tbl = au.table.TableObj(r"C:\path\to\featureclass")
|
|
111
|
-
dup_values = tbl.find_duplicate_field_values("STATUS", output="set")
|
|
112
|
-
dup_rows_df = tbl.find_duplicate_field_values(["STATUS", "TYPE"], output="df")
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Contribution guidelines ###
|
|
116
|
-
|
|
117
|
-
Contributions welcomed, this is a starting point for various utilities that I think could be useful within ArcGIS Pro.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: arc-utils
|
|
3
|
+
Version: 1.4.0
|
|
4
|
+
Summary: Python utilities for use with Esri ArcGIS Pro software
|
|
5
|
+
Author-email: Grant Herbert <gdherbert@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/gdherbert/arc_utils
|
|
8
|
+
Project-URL: Download, https://github.com/gdherbert/arc_utils/tree/1.3
|
|
9
|
+
Keywords: esri,arcpy,arcgis
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE.txt
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# README #
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### What is this repository for? ###
|
|
24
|
+
* A collection of (mostly) arcpy related utilities for use within ArcGIS Pro (Python 3).
|
|
25
|
+
Shortcuts for accessing elements of a map document, performing various data discovery tasks on a table or geodatabase
|
|
26
|
+
|
|
27
|
+
### How do I get set up? ###
|
|
28
|
+
|
|
29
|
+
Install from PyPI:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install arc-utils
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
For local development and editable usage from clone:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
python -m pip install -e .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
To use the utilities:
|
|
42
|
+
|
|
43
|
+
* in the python window in ArcGIS Pro
|
|
44
|
+
|
|
45
|
+
``import arc_utils as au``
|
|
46
|
+
|
|
47
|
+
* typing ``au.`` will now reveal the modules and functions available to you if you have autocomplete on
|
|
48
|
+
|
|
49
|
+
* Depends on arcpy (only available with Esri license)
|
|
50
|
+
|
|
51
|
+
### Example usage ###
|
|
52
|
+
|
|
53
|
+
``import arc_utils as au``
|
|
54
|
+
|
|
55
|
+
``tbl = au.table.TableObj(path to featureclass)``
|
|
56
|
+
|
|
57
|
+
# list all fields
|
|
58
|
+
|
|
59
|
+
``print(tbl.fields)``
|
|
60
|
+
|
|
61
|
+
``pro_doc = au.aprx.AprxObj(“CURRENT”)``
|
|
62
|
+
|
|
63
|
+
``pro_doc.maps`` >> [<arcpy._mp.Map object at 0x000001A4AECBF108>, <arcpy._mp.Map object at 0x000001A4AEBB6608>]
|
|
64
|
+
|
|
65
|
+
``pro_doc.maps[0].name`` >> ‘Map’
|
|
66
|
+
|
|
67
|
+
### Accepted Input Types ###
|
|
68
|
+
|
|
69
|
+
Most path parameters now accept:
|
|
70
|
+
|
|
71
|
+
* string path
|
|
72
|
+
* ``pathlib.Path`` / other path-like objects
|
|
73
|
+
* wrapper objects with ``.path``
|
|
74
|
+
* ArcGIS layer/table objects with ``.catalogPath`` or ``.dataSource`` (where applicable)
|
|
75
|
+
|
|
76
|
+
Invalid paths raise ``ValueError("invalid path")``.
|
|
77
|
+
|
|
78
|
+
Constructor acceptance is preserved (for example, passing path-like and wrapper objects directly to ``TableObj``, ``GDBObj``, and ``AprxObj``).
|
|
79
|
+
|
|
80
|
+
### Exporting field values to Excel ###
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import arc_utils as au
|
|
84
|
+
from openpyxl import Workbook
|
|
85
|
+
|
|
86
|
+
# Single table export with class method
|
|
87
|
+
tbl = au.table.TableObj(r"C:\path\to\featureclass")
|
|
88
|
+
wb = Workbook()
|
|
89
|
+
ws = wb.active
|
|
90
|
+
tbl.export_fields_to_worksheet(ws)
|
|
91
|
+
wb.save(r"C:\path\to\schema_values.xlsx")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
# Multi-layer export with module function
|
|
96
|
+
layers = [r"C:\path\to\layer1", r"C:\path\to\layer2"]
|
|
97
|
+
au.table.export_field_sets(layers, r"C:\path\to\all_layers.xlsx")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
# Worksheet naming behavior:
|
|
102
|
+
# use_lyr_alias=True -> prefer alias/name (human-readable)
|
|
103
|
+
# use_lyr_alias=False -> use full table path (traceable)
|
|
104
|
+
au.table.export_field_sets(layers, r"C:\path\to\all_layers.xlsx", use_lyr_alias=True)
|
|
105
|
+
au.table.export_field_sets(layers, r"C:\path\to\all_layers_by_path.xlsx", use_lyr_alias=False)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
# Duplicate detection outputs
|
|
110
|
+
tbl = au.table.TableObj(r"C:\path\to\featureclass")
|
|
111
|
+
dup_values = tbl.find_duplicate_field_values("STATUS", output="set")
|
|
112
|
+
dup_rows_df = tbl.find_duplicate_field_values(["STATUS", "TYPE"], output="df")
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Contribution guidelines ###
|
|
116
|
+
|
|
117
|
+
Contributions welcomed, this is a starting point for various utilities that I think could be useful within ArcGIS Pro.
|
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
# README #
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### What is this repository for? ###
|
|
5
|
-
* A collection of (mostly) arcpy related utilities for use within ArcGIS Pro (Python 3).
|
|
6
|
-
Shortcuts for accessing elements of a map document, performing various data discovery tasks on a table or geodatabase
|
|
7
|
-
|
|
8
|
-
### How do I get set up? ###
|
|
9
|
-
|
|
10
|
-
Install from PyPI:
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
pip install arc-utils
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
For local development and editable usage from clone:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
python -m pip install -e .
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
To use the utilities:
|
|
23
|
-
|
|
24
|
-
* in the python window in ArcGIS Pro
|
|
25
|
-
|
|
26
|
-
``import arc_utils as au``
|
|
27
|
-
|
|
28
|
-
* typing ``au.`` will now reveal the modules and functions available to you if you have autocomplete on
|
|
29
|
-
|
|
30
|
-
* Depends on arcpy (only available with Esri license)
|
|
31
|
-
|
|
32
|
-
### Example usage ###
|
|
33
|
-
|
|
34
|
-
``import arc_utils as au``
|
|
35
|
-
|
|
36
|
-
``tbl = au.table.TableObj(path to featureclass)``
|
|
37
|
-
|
|
38
|
-
# list all fields
|
|
39
|
-
|
|
40
|
-
``print(tbl.fields)``
|
|
41
|
-
|
|
42
|
-
``pro_doc = au.aprx.AprxObj(“CURRENT”)``
|
|
43
|
-
|
|
44
|
-
``pro_doc.maps`` >> [<arcpy._mp.Map object at 0x000001A4AECBF108>, <arcpy._mp.Map object at 0x000001A4AEBB6608>]
|
|
45
|
-
|
|
46
|
-
``pro_doc.maps[0].name`` >> ‘Map’
|
|
47
|
-
|
|
48
|
-
### Accepted Input Types ###
|
|
49
|
-
|
|
50
|
-
Most path parameters now accept:
|
|
51
|
-
|
|
52
|
-
* string path
|
|
53
|
-
* ``pathlib.Path`` / other path-like objects
|
|
54
|
-
* wrapper objects with ``.path``
|
|
55
|
-
* ArcGIS layer/table objects with ``.catalogPath`` or ``.dataSource`` (where applicable)
|
|
56
|
-
|
|
57
|
-
Invalid paths raise ``ValueError("invalid path")``.
|
|
58
|
-
|
|
59
|
-
Constructor acceptance is preserved (for example, passing path-like and wrapper objects directly to ``TableObj``, ``GDBObj``, and ``AprxObj``).
|
|
60
|
-
|
|
61
|
-
### Exporting field values to Excel ###
|
|
62
|
-
|
|
63
|
-
```python
|
|
64
|
-
import arc_utils as au
|
|
65
|
-
from openpyxl import Workbook
|
|
66
|
-
|
|
67
|
-
# Single table export with class method
|
|
68
|
-
tbl = au.table.TableObj(r"C:\path\to\featureclass")
|
|
69
|
-
wb = Workbook()
|
|
70
|
-
ws = wb.active
|
|
71
|
-
tbl.export_fields_to_worksheet(ws)
|
|
72
|
-
wb.save(r"C:\path\to\schema_values.xlsx")
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
```python
|
|
76
|
-
# Multi-layer export with module function
|
|
77
|
-
layers = [r"C:\path\to\layer1", r"C:\path\to\layer2"]
|
|
78
|
-
au.table.export_field_sets(layers, r"C:\path\to\all_layers.xlsx")
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
```python
|
|
82
|
-
# Worksheet naming behavior:
|
|
83
|
-
# use_lyr_alias=True -> prefer alias/name (human-readable)
|
|
84
|
-
# use_lyr_alias=False -> use full table path (traceable)
|
|
85
|
-
au.table.export_field_sets(layers, r"C:\path\to\all_layers.xlsx", use_lyr_alias=True)
|
|
86
|
-
au.table.export_field_sets(layers, r"C:\path\to\all_layers_by_path.xlsx", use_lyr_alias=False)
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
```python
|
|
90
|
-
# Duplicate detection outputs
|
|
91
|
-
tbl = au.table.TableObj(r"C:\path\to\featureclass")
|
|
92
|
-
dup_values = tbl.find_duplicate_field_values("STATUS", output="set")
|
|
93
|
-
dup_rows_df = tbl.find_duplicate_field_values(["STATUS", "TYPE"], output="df")
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Contribution guidelines ###
|
|
97
|
-
|
|
98
|
-
Contributions welcomed, this is a starting point for various utilities that I think could be useful within ArcGIS Pro.
|
|
1
|
+
# README #
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### What is this repository for? ###
|
|
5
|
+
* A collection of (mostly) arcpy related utilities for use within ArcGIS Pro (Python 3).
|
|
6
|
+
Shortcuts for accessing elements of a map document, performing various data discovery tasks on a table or geodatabase
|
|
7
|
+
|
|
8
|
+
### How do I get set up? ###
|
|
9
|
+
|
|
10
|
+
Install from PyPI:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install arc-utils
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
For local development and editable usage from clone:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
python -m pip install -e .
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
To use the utilities:
|
|
23
|
+
|
|
24
|
+
* in the python window in ArcGIS Pro
|
|
25
|
+
|
|
26
|
+
``import arc_utils as au``
|
|
27
|
+
|
|
28
|
+
* typing ``au.`` will now reveal the modules and functions available to you if you have autocomplete on
|
|
29
|
+
|
|
30
|
+
* Depends on arcpy (only available with Esri license)
|
|
31
|
+
|
|
32
|
+
### Example usage ###
|
|
33
|
+
|
|
34
|
+
``import arc_utils as au``
|
|
35
|
+
|
|
36
|
+
``tbl = au.table.TableObj(path to featureclass)``
|
|
37
|
+
|
|
38
|
+
# list all fields
|
|
39
|
+
|
|
40
|
+
``print(tbl.fields)``
|
|
41
|
+
|
|
42
|
+
``pro_doc = au.aprx.AprxObj(“CURRENT”)``
|
|
43
|
+
|
|
44
|
+
``pro_doc.maps`` >> [<arcpy._mp.Map object at 0x000001A4AECBF108>, <arcpy._mp.Map object at 0x000001A4AEBB6608>]
|
|
45
|
+
|
|
46
|
+
``pro_doc.maps[0].name`` >> ‘Map’
|
|
47
|
+
|
|
48
|
+
### Accepted Input Types ###
|
|
49
|
+
|
|
50
|
+
Most path parameters now accept:
|
|
51
|
+
|
|
52
|
+
* string path
|
|
53
|
+
* ``pathlib.Path`` / other path-like objects
|
|
54
|
+
* wrapper objects with ``.path``
|
|
55
|
+
* ArcGIS layer/table objects with ``.catalogPath`` or ``.dataSource`` (where applicable)
|
|
56
|
+
|
|
57
|
+
Invalid paths raise ``ValueError("invalid path")``.
|
|
58
|
+
|
|
59
|
+
Constructor acceptance is preserved (for example, passing path-like and wrapper objects directly to ``TableObj``, ``GDBObj``, and ``AprxObj``).
|
|
60
|
+
|
|
61
|
+
### Exporting field values to Excel ###
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import arc_utils as au
|
|
65
|
+
from openpyxl import Workbook
|
|
66
|
+
|
|
67
|
+
# Single table export with class method
|
|
68
|
+
tbl = au.table.TableObj(r"C:\path\to\featureclass")
|
|
69
|
+
wb = Workbook()
|
|
70
|
+
ws = wb.active
|
|
71
|
+
tbl.export_fields_to_worksheet(ws)
|
|
72
|
+
wb.save(r"C:\path\to\schema_values.xlsx")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
# Multi-layer export with module function
|
|
77
|
+
layers = [r"C:\path\to\layer1", r"C:\path\to\layer2"]
|
|
78
|
+
au.table.export_field_sets(layers, r"C:\path\to\all_layers.xlsx")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
# Worksheet naming behavior:
|
|
83
|
+
# use_lyr_alias=True -> prefer alias/name (human-readable)
|
|
84
|
+
# use_lyr_alias=False -> use full table path (traceable)
|
|
85
|
+
au.table.export_field_sets(layers, r"C:\path\to\all_layers.xlsx", use_lyr_alias=True)
|
|
86
|
+
au.table.export_field_sets(layers, r"C:\path\to\all_layers_by_path.xlsx", use_lyr_alias=False)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
# Duplicate detection outputs
|
|
91
|
+
tbl = au.table.TableObj(r"C:\path\to\featureclass")
|
|
92
|
+
dup_values = tbl.find_duplicate_field_values("STATUS", output="set")
|
|
93
|
+
dup_rows_df = tbl.find_duplicate_field_values(["STATUS", "TYPE"], output="df")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Contribution guidelines ###
|
|
97
|
+
|
|
98
|
+
Contributions welcomed, this is a starting point for various utilities that I think could be useful within ArcGIS Pro.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""A collection of python utilities for ArcGIS Pro
|
|
2
|
+
"""
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
__version__ = version('arc-utils')
|
|
7
|
+
except PackageNotFoundError:
|
|
8
|
+
__version__ = '0+unknown'
|
|
9
|
+
|
|
10
|
+
__author__ = 'Grant Herbert'
|
|
11
|
+
|
|
12
|
+
__all__ = ['aprx.py', 'gdb.py', 'table.py']
|
|
13
|
+
|
|
14
|
+
from arc_utils import gdb
|
|
15
|
+
from arc_utils import table
|
|
16
|
+
from arc_utils import aprx
|