|
POST
|
Hello, I thought I would post a question I am having to see if Python can work with what I'm trying to accomplish. I know Python at the most basic level so any help would be appreciated. I am trying to select the appropriate township, range, section, quarter, and quarter quarter section data from a separate table that contains what I am wanting queried. In the most Lehman terms possible, I have one data set of PLSS data and then a separate table that has a column (attribute) of specific locations such as T 1 S R 3 W Section 27 or NWSW, NWSE, NENW, NESW, NESE, SWNE, SWSW, SWSE, SENW, SESW, SESE. What I am trying to accomplish is I want to generate an easy way of selecting my PLSS data from this table of attributes so I do not have to find them individually. I hope this makes sense. Thank you kindly for any help! You may have to clarify a bit, but it doesn't sound like you need Python to accomplish this at all. Why not simply join your PLSS layer with your table of attributes? You can then just make your required selections on the PLSS layer.
... View more
04-28-2014
04:31 AM
|
0
|
0
|
1221
|
|
POST
|
http://resources.arcgis.com/en/help/main/10.1/index.html#//018v0000008v000000 Final edit (lol): This will alter the AliasName of your FeatureClass with the name of the FeatureClass. fc = r'H:\Documents\ArcGIS\Default.gdb\MyFeatClass' desc = arcpy.Describe(fc) arcpy.AlterAliasName(fc, desc.name)
... View more
04-25-2014
04:50 AM
|
0
|
0
|
1406
|
|
POST
|
Make sure "CrimeType" is a field that actually exists in CopyCopySample2011_2013.shp. Also: "CopyCopy"????
... View more
04-23-2014
10:06 AM
|
0
|
0
|
1629
|
|
POST
|
Check if the ANYNODATA or ALLNODATA properties of GetRasterPorperties_management will do what you want: http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000m7000000 Here is an exmple of running thru the Default.gdb on my system and reporting the raster name and ANYNODATA value
ws = r'H:\Documents\ArcGIS\Default.gdb'
arcpy.env.workspace = ws
rasters = arcpy.ListRasters()
for raster in rasters:
nodatval = arcpy.GetRasterProperties_management(raster, "ANYNODATA")
print str(raster) + " NoData = " + str(nodatval)
sys.exit()
... View more
04-23-2014
08:01 AM
|
0
|
0
|
2423
|
|
POST
|
Unfortunately the 'ARE_IDENTICAL_TO' in Select wasn't picking up any of my duplicate geometries in my test set...(go, fig. Maybe floating point error? They are lines). I tested in both GUI and code. This was the only way to grab them... What if you apply a small buffer/distance_within in your selection process to try and eliminate the floating point issue? Otherwise it could get a little messy beacause I think you would have to write coordinate pairs of each polyline to an array, create a new InsertCursor on the destination FeatureClass, create new polylines from the arrays and write them to the destination. Not completely un-doable tho (see the last example): http://resources.arcgis.com/en/help/main/10.1/index.html#//018w0000000t000000
... View more
04-22-2014
07:34 AM
|
0
|
0
|
4011
|
|
POST
|
Perhaps SelectLayerByAttribute to get your selection, then CopyFeatures is a better alternative? http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000071000000
... View more
04-22-2014
07:13 AM
|
0
|
0
|
4011
|
|
POST
|
I see what you mean -- are you dynamically creating this .gdb? Try setting your ScratchWorkspace to the folder that contains the .gdb you want to delete. This works for me:
ws = r'H:\Documents\ArcGIS'
arcpy.env.workspace = ws
arcpy.env.scratchWorkspace = ws
items = arcpy.ListFiles('*.gdb')
for item in items:
if item == 'test.gdb':
arcpy.Delete_management(item)
print "deleted" + str(item)
... View more
04-22-2014
07:07 AM
|
0
|
0
|
9073
|
|
POST
|
Thanks James, I'll try env.overwrite. In answer to your other question, yes, I'm trying to delete the entire database after it has been zipped. We zip the data so that they are easily deliverable to FEMA, engineers, public, etc. After they are zipped, I don't need the database or shapes anymore because the master statewide files are stored in SDE--the the script exports FIRM data by county. I didn't think that bit of code should have anything to do with the delete error either. Which is precisely why I've been scratching head for the last two days. It's just weird. Nonetheless, when i strip the script of that bit of code, the files zip and then get deleted without issue. With the code, the geodatabase is locked by RuntimeLocalServer.exe. overwriteOutput wouldn't make any difference in this case (I was confused because the code you posted is attempting to delete Feature Classes, NOT deleting the .gdb). So.... Where is the code for deleting the .gdb? You never posted it.
... View more
04-22-2014
06:00 AM
|
0
|
0
|
9072
|
|
POST
|
Edit: Looking at your error message, it says you are trying to delete the whole .gdb --- is that what you want to do? In any case, the code you posted has nothing to do with the error you are recieving and it is very difficult to determine your issue. You may have to post the appropriate offending code. "Cannot delete C:\~Working\FRIS\Test2\Alamance\NCFlood_Prelim_Alamance_GDB.gdb." Maybe try setting the overwriteOutput environment to True?
arcpy.env.overwriteOutput = True
http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000004s000000
... View more
04-22-2014
04:43 AM
|
0
|
0
|
9072
|
|
POST
|
Just a quick shot in the dark, maybe try hard-coding the versioned .sde file instead of:
workspace = (version)
Just hard-code the workspace:
workspace = (r"C:\Users\mosleya\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\name of the versioned data connection.sde")
... View more
04-21-2014
05:44 AM
|
0
|
0
|
2113
|
|
POST
|
You will probably have to post up your code to get any answer with precision. In the meantime, how close are you to the work examples here: http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000005000000
... View more
04-21-2014
05:26 AM
|
0
|
0
|
765
|
|
POST
|
I am unsure if your Power() method is properly formed. http://resources.arcgis.com/en/help/main/10.1/index.html#//009z00000097000000 It takes two parameters but it doesn't look like you are supplying these.
Power (in_raster_or_constant1, in_raster_or_constant2)
Also, I noticed that there is an extra "(" paren char:
X25 = Power(((Log10(4)) - Raster("D25") * (Log10(4) - Log10(10)) / (Raster("D25") - Raster("D10")),10)
... View more
04-16-2014
05:09 AM
|
0
|
0
|
1757
|
|
POST
|
arcpy.env.overwriteOutput = True works correctly when using the add-in, not with copy-and-pasting into the Python window. Thanks all for your help. Did you set the workspace prior to setting overwriteOutput property? In any case, I just prefer to do the removal myself rather than using the overwriteOutput = True because I am certain the job is getting done.
... View more
04-15-2014
07:08 AM
|
0
|
0
|
707
|
|
POST
|
Changed my code to include the double slash and I'm still getting an error about in_memory/dissolved existing when I run the script for a second time. I didn't fully review your codebase, but when I am doing iterative intermediate data creation then I will simply use the in_memory space as temporary workspace for the iteration. That is, once a proc/step is complete then I remove everything from the workspace. Here's a def I add to my .py file and simply call from the loop(s)
def clearINMEM():
""" clear out the IN_MEMORY workspace of any featureclasses """
arcpy.env.workspace = "IN_MEMORY"
fcs = arcpy.ListFeatureClasses()
### for each FeatClass in the list of fcs's, delete it.
for f in fcs:
arcpy.Delete_management(f)
... View more
04-15-2014
06:20 AM
|
0
|
0
|
2844
|
|
POST
|
Maybe this?
gp.CostPath_sa("samp_lyr", cd_name, bl_name, "cost_path", "BEST_SINGLE", "#")
... View more
04-10-2014
06:58 AM
|
0
|
0
|
2129
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-17-2020 10:47 AM | |
| 1 | 10-25-2022 11:46 AM | |
| 1 | 08-08-2022 01:40 PM | |
| 1 | 02-15-2019 08:21 AM | |
| 2 | 08-14-2023 07:14 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-22-2025
02:28 PM
|