POST
|
I am trying to use the Apportion Polygon tool to summarize the total square kilometers of crop land that falls in a series of travel time catchment area polygons. My summary layer is a vectorized landcover crop mask. The target layer consists of travel time catchment area polygons (see screenshot - orange is input layer, blue is target layer). Both layers are in a file geodatabase, and I am only trying to summarize the AREA_GEO field into the target layer. After running for a couple of minutes, the tool failed with the following error messages: ERROR 002834: The geometry operation was cancelled. ERROR 002834: The geometry operation was cancelled. Failed to execute (ApportionPolygon). Alternative to this tool, I am open to using a combination of tools such as intersect and summarize within. My goal is to split the input polygons along the boundaries of the target polygons, and get the sum AREA_GEO field into the target polys. Any help would be greatly appreciated!
... View more
10-28-2021
12:40 PM
|
0
|
2
|
1274
|
POST
|
If this is a one-off issue, perhaps the topological editing tools could be useful. In Pro, go to Edit > Modify Features > Align features. (see reference here). You can select the segments to align, set the snapping tolerance as needed, and even identify a point location (the node in your image) to align the segments to.
... View more
09-24-2021
11:04 AM
|
0
|
0
|
941
|
POST
|
Thanks, Josh! Quick follow-up question, I'm still wrapping my head around the difference between arcgis and arcpy. Is arcgis used to access the ArcGIS API, while arcpy is pulling from your local instance of Pro? Also, good to know about limitations of modifying a python env in Pro, saves me time knowing it's not really possible. Thanks again! Jo
... View more
09-24-2021
10:39 AM
|
0
|
0
|
1088
|
POST
|
Hello @jcarlson, I'm trying to do the same thing as OP. Do you have any tips on successfully creating an environment where arcpy and geopandas work together? I am using a cloned python environment in ArcGIS Pro. I am getting a failed message when trying to conda-forge install geopandas. I also am worried about the same thing occurring when trying to install shapely.. Many thanks!
... View more
09-24-2021
05:46 AM
|
0
|
2
|
8733
|
POST
|
Hi David, thanks so much. I'll give that a go. Reclass will probably quicken the raster to polygon process!
... View more
09-15-2021
11:21 AM
|
0
|
0
|
1121
|
POST
|
Hi all, I'm curious if anyone has been able to clip a polygon dataset using the extent of a raster dataset, using ArcPro? Or simply get the bbox of the raster without python. I'd much prefer to save time and not to convert the raster to polygon, as it is extremely large and high-res, but maybe this is a pipe dream. Thanks!
... View more
09-15-2021
10:12 AM
|
0
|
2
|
1136
|
POST
|
Thanks Jayanta - I followed these steps but now the second, appended layer (33N) nearly replaced the original (32N) layer that was projected in step 2. The total is still around 4.4million rather than the expected 8-9million features. Are there also size limits in file geodatabases as well?
... View more
08-23-2021
02:33 PM
|
0
|
0
|
843
|
POST
|
I am trying to merge two separate datasets (shapefiles) which each have about 4 million features each. Each one is in a different UTMZ (32N and 33N) and do not intersect because they are supposed to be combined to fit the entire area of interest. I have tried both merge and append to combine these two datasets, however both times the outputs only produce about 24k additional features to the first dataset that gets read in, even though there is no warning or error message. The merged features are geographically dispersed across the AOI and geographically seem to line up with the original dataset Should I reproject to GCS and then try merging? Simply merging takes ~7 hours, so I wanted to try other things before taking that step. Otherwise, would it be recommended to import them into a GDB? Any advice would be greatly appreciated, and happy to clarify the issue more. thanks!
... View more
08-23-2021
08:51 AM
|
0
|
2
|
890
|
POST
|
Hi @DanPatterson thank you! I had also tried reversing the order but was still getting the same result. The suggestion from Joe Borgione to run Add Join worked for my use case.
... View more
01-05-2021
10:51 AM
|
0
|
0
|
2897
|
POST
|
Hi @JoeBorgione , thanks for the suggestion - this is what I needed. Sometimes the simpler option is the best one!
... View more
01-05-2021
10:50 AM
|
0
|
0
|
2898
|
POST
|
Hello, I am writing a for loop to iterate through the join field tool on a geodatabase of tables. My final goal is to have one table containing the fields of all other tables in the GDB. Here is the relevant code: arcpy.env.workspace = r"C:\My_GDB.gdb"
join_field = "CommuneCode"
join_table = r"C:\My_GDB.gdb\chirps_2020_04_tbl"
tables = arcpy.ListTables()
counter = 1
for table in tables:
print ("processing: " + table)
arcpy.JoinField_management(table, join_field, join_table, join_field)
print("%s of %s tables processed" % (counter, len(tables)))
counter += 1
print("Processing complete.") The actual results of this loop appends the fields from the join_table object onto each of the tables in the GDB. What I would actually like is the opposite, joining all tables in the GDB to the join_table. I would greatly appreciate any tips here. Thanks in advance!
... View more
01-05-2021
08:31 AM
|
0
|
4
|
2922
|
POST
|
Hello @tt1 , I'm encountering a similar problem. Did you happen to solve it? Thanks!
... View more
01-01-2021
06:33 AM
|
0
|
0
|
1091
|
POST
|
I am also having this issue in 2.6, and had the same issue as OP. Seems to be that you have to re-create the clone every time you update.
... View more
09-29-2020
09:28 AM
|
0
|
1
|
1446
|
POST
|
Hi Joshua, thank you. this makes sense and was helpful. Unfortunately I am now getting an OSerror again, that a file doesn't exist. It seems as though the for fname loop is not being iterated at all, as it is not printing anything. I think it could have to do with the fname variable again, but I can't tell what aspect of it is. My updated code is as follows: import arcpy, os, sys
from arcpy import env
arcpy.env.overwriteOutput = True
# Set the workspace directory - make sure it's the copied gdb and not the original, in case you mess up
arcpy.env.workspace = r"mygdb_.gdb"
# Get the list of the zonal stats tables to process
tables = arcpy.ListTables()
print(tables)
# iterate through the tables in the gdb and update field names with the file names
for table in tables:
print("processing: " + table)
expression = str(table) # populates field
# iterate through field names in the table and alter field name
for fname in [f.name for f in arcpy.ListFields(table, wild_card="*AFG_proj_zonalst", field_type="ALL") if not f.required]:
print(fname)
arcpy.AlterField_management(table, fname, fname+'"'+expression+'"')
print(fname)
with arcpy.da.UpdateCursor(table, [fname]) as uc:
for row in uc:
uc.updateRow([str(table)])
del row, uc and the error message: [prints list of files]
processing: NTL_QN_202001_AFG_proj_zonalst
processing: NTL_QN_202001_AFG_zonalst
processing: NTL_QN_202001_proj_zonalst
processing: NTL_QN_202001_zonalst
processing: NTL_201912_AFG_proj_zonalst
processing: NTL_201911_AFG_proj_zonalst
processing: NTL_201910_AFG_proj_zonalst
processing: NTL_201909_AFG_proj_zonalst
processing: NTL_201908_AFG_proj_zonalst
processing: NTL_201907_AFG_proj_zonalst
processing: NTL_201906_AFG_proj_zonalst
processing: NTL_201905_AFG_proj_zonalst
processing: NTL_201904_AFG_proj_zonalst
processing: NTL_201903_AFG_proj_zonalst
processing: NTL_201902_AFG_proj_zonalst
processing: NTL_201901_AFG_proj_zonalst ---------------------------------------------------------------------------OSError
Traceback (most recent call last)<ipython-input-5-7d2495ac6c17> in <module>
17 expression = str(table) # populates field
18 # iterate through field names in the table and alter field name
---> 19 for fname in [f.name for f in arcpy.ListFields(table, wild_card="*AFG_proj_zonalst", field_type="ALL") if not f.required]:
20 print(fname)
21 arcpy.AlterField_management(table, fname, fname+'"'+expression+'"')C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py in ListFields(dataset, wild_card, field_type)
1131
1132 * String: Only field types of String are returned."""
-> 1133 return gp.listFields(dataset, wild_card, field_type)
1134
1135 @_gptooldoc(None, [[["FeatureLayer", "Table", "TableView", "Dataset", "FeatureDataset"], "", "", ""]])C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py in listFields(self, *args)
346 from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
347 return convertArcObjectToPythonObject(
--> 348 self._gp.ListFields(*gp_fixargs(args, True)))
349 def listIndexes(self, *args):
350 """GP function ListIndexes"""
OSError: "NTL_201901_AFG_proj_zonalst" does not exist
... View more
07-29-2020
08:33 AM
|
0
|
0
|
2892
|
POST
|
Hi Joshua, thanks for your quick response - It was indeed an issue with calling the list of tables instead of a single table. After updating the line, I no longer have the OSError, but am now having the following error: "NameError: name 'f' is not defined". It was my understanding that 'f' is just the iterator variable for the list of fieldnames, and does not need to be defined before being called. Sorry for the really simple questions, I'm new to arcpy so it's probably another beginner error.
... View more
07-28-2020
10:26 AM
|
0
|
1
|
2892
|
Title | Kudos | Posted |
---|---|---|
2 | 01-02-2020 01:42 PM |