12/9/2023 0 Comments Calculate geometry x arcpyI've used three different county layers so far, ran them through the feature class to feature class tool after the first attempts didn't work, used the Add Geometry Attributes tool, used the Feature to Point tool, and combined the tools in every way I could think of. I just have two fields fill of values even though the tool runs successfully. Select a few parameters and click OK and then the longitude and latitude fields should populate with the coordinates, right? Create two new fields of type double, label them appropriately, right click, and select "calculate geometry". The feature to point tool quickly creates a point layer with the centroids, but the coordinates are not added to the attribute table. I'm trying to get coordinates for the centroids of the counties in a state. But right now, I'm having a hell of a time getting it to work. It's one of the most basic things that we can do in GIS. ( deprecated tools will continue to work, but will not be updated/fix moving forward) Something to keep in mind if you update.Calculating geometry is easy. I'll also mention (and it shouldn't have any baring on your question at hand), the AddGeometryTool appears to be deprecated in favor of the CalculateGeometryTool in Pro 3.0. Build up a path like: import osįullyQualifiedFC = os.path.join(workspace, fc)Īrcpy.MyToolDoesSomething(fullyQualifiedFC) Personally, I prefer fully qualified as there leaves no guessing which path is being passed in. Either be 100% relative, or 100% fully qualified. I'd suggest going back and re-working your code and your paths. However, those tools before the AddGeometry are system tools and might be able to handle the path better than AddGeometry which is a system- script tool (but this is just a guess). The even stranger thing is it blows up in the AddGeometry tool, making it sound like the tools before it are able to rectify the path. I can't tell what your work variable is pointing at based on your code. Generally when using a relative path, you'd only use the featureclass name, like blobs_exp, and your workspace would be set to the full path of your GDB, something like c:\mydata\WY_testing.gdb. This is a strange half-relative, half-full path. It appears the path's you are creating and passing into the tools are half relative paths, half full paths, as such I think the tool is blowing up while trying to rectify the path to the dataset. OSError: "WY_testing.gdb\blobs_exp" does not existįailed to execute (AddGeometryAttributes). Self._gp.Describe(*gp_fixargs(args, True))) Sys.exit('12 - could not find blobs poly')ġ2 error - Traceback (most recent call last):įile "c:\program files\arcgis\pro\Resources\ArcToolbox\scripts\AddGeometryAttributes.py", line 396, inĪddGeomAtts = AddGeometryAttributes(fc, geomProperties, lUnit, aUnit, cs)įile "c:\program files\arcgis\pro\Resources\ArcToolbox\scripts\AddGeometryAttributes.py", line 30, in initįile "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy_ init_.py", line 1287, in Describeįile "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing_base.py", line 384, in describe Sys.exit('12 - could not find exploded blobs') # The wetlands_gdb path below may need to be altered if the shared drive file structure changes. # If you aren't sure which epsg code to use, stick with NAD83 GCS ('4269') or you can try leaving a blank string ''. # This epsg code is meant to be the best projection for the entire state, usually a UTM zone or a custom state projection. # Input the abbreviation for the state you want to process. This seems like something small that I could be missing, but I just can't seem to figure it out so I could use the help. I've included the error and a small snippet of code below. So this error is kind of stumping me and it seems to be related to only these arcpy functions. I have verified the script has access to this featureclass by running other methods against it like creating a field list and printing out all the field names, etc. I've attempted running both of them and get the same result, a traceback OSError that claims the featureclass does not exist (see below). I've discovered what looks like two arcpy options that should be able to do this, the CalculateGeometryAttributes and AddGeometryAttributes functions/methods. I'm at a stage where I want to calculate the geometry of that polygon layer in a field in acres units. I'm writing a couple classes with a variety of methods to process some data. I've been banging my head on this one for a day or so and not sure what it is.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |