POST
|
I have used this approach as well at some projects.
... View more
01-26-2021
02:24 AM
|
0
|
0
|
1152
|
POST
|
And dont' forget... with all the best plans laid, there will be some featureclasses that don't conform to your naming plan 😉
... View more
01-22-2021
11:16 AM
|
1
|
0
|
711
|
POST
|
Thanks very much. This solved that problem. Looks like I need some more time learning the details of Python. Be well, Bill Cole
... View more
01-17-2021
07:06 AM
|
0
|
0
|
2476
|
POST
|
It looks like you're already getting your query parameters and setting an expression. However, it doesn't look like you're doing anything to query or highlight the features. Take a look at this sample.
... View more
01-15-2021
11:22 AM
|
0
|
0
|
580
|
POST
|
No worries. Looks like you were able to get to the root of the problem. Carry on!
... View more
01-14-2021
01:33 PM
|
1
|
0
|
2833
|
POST
|
It works, Thank you very Much @BlakeTerhune @JohnGrayson
... View more
01-08-2021
05:04 PM
|
0
|
0
|
2433
|
POST
|
I was able to achieve creating the blocks with the following below but would be nice if could have populate the attributes based on a formula and this is beyond me. I attached the sections in case anyone wants to help out. import arcpy, os
arcpy.env.overwriteOutput = True
def CreateFishnetsForFeats(shp, out, cell_x=0, cell_y=0, n_rows=0, n_cols=0):
# Create file gdb to store data
gdb = str(arcpy.CreateFileGDB_management(out, 'Fishnets.gdb').getOutput(0))
# spatial reference
arcpy.env.outputCoordinateSystem = arcpy.Describe(shp).spatialReference
# Loop thru rows of input polygons
with arcpy.da.SearchCursor(shp, ['SHAPE@', 'OID@']) as rows:
for row in rows:
ext = row[0].extent
st = '%f %f' %(ext.XMin, ext.YMin)
ort = '%f %f' %(ext.XMin, ext.YMax)
# Create fishnet
outFn = os.path.join(gdb, 'fish_{0}'.format(row[1]))
arcpy.CreateFishnet_management(outFn, st, ort, cell_x,cell_y, n_rows, n_cols,
labels='NO_LABELS',template = ext,
geometry_type='POLYGON')
# set workspace to new gdb
arcpy.env.workspace = gdb
fishnets = arcpy.ListFeatureClasses()
targ = fishnets[0]
for i, fish in enumerate(fishnets):
# Add field for original polygon ID
fid = fish.split('_')[1]
arcpy.AddField_management(fish, 'POLY_ID', 'LONG')
with arcpy.da.UpdateCursor(fish, ['POLY_ID']) as rows:
for row in rows:
row[0] = fid
rows.updateRow(row)
# append fishnets into one feature class
if i > 0:
arcpy.Append_management([fish], targ, 'NO_TEST')
arcpy.Delete_management(fish)
print (*'Appended: {0}'.format(fish))
print ('Done')
return
if __name__ == '__main__':
polys = r'C:\Temp\SectionGrid\SectionsCopy.shp'
loc = r'C:\TEMP'
CreateFishnetsForFeats(polys, loc, 0, 0, 9, 9)
... View more
01-08-2021
10:36 AM
|
0
|
0
|
271
|
POST
|
It works pretty well. I integrated a buffer option into my sketch toolbar.
... View more
01-07-2021
09:44 AM
|
1
|
0
|
2141
|
POST
|
There's a lot going on in your code that is either redundant or slightly off. I recommend familiarizing yourself with the syntax of FeatureClassToFeatureClass_conversion() Here's a simplified version. See if this runs and does what you want. import arcpy
sde_workspace = r"D:\Users\user\Documents\ArcGIS\Projects\Databases\SDE.sde"
env_gdb = r"W:\My Documents\user\ENV.gdb\ENV"
print("START")
for ds in arcpy.ListDatasets(feature_type="Feature"):
new_name = ds.split(".")[-1]
print("Copying {}".format(new_name))
arcpy.FeatureClassToFeatureClass_conversion(ds, outLocation, new_name)
... View more
01-05-2021
06:45 AM
|
2
|
0
|
967
|
POST
|
I'm not the OP, but I've got the same problem... The idea isn't to choose a field name, but the field value. For example, imagine a tool that exports data from a user-specified row to Excel. The user opens the tool and sees a dropdown list of existing values in a field of the table, eg permit codes or parcel numbers. In the python toolbox, you can populate that list with something like this: class Tool:
def getParameterInfo(self):
p0 = arcpy.Parameter(...)
with arcpy.da.SearchCursor(layer_or_table, [field]) as cursor:
p0.filter.list = [row[0] for row in cursor]
return [p0] Each time you start that tool in Pro, it searches the specified layer/table for values. If you add a new value, it will be shown in the dropdown list the next time you start the tool. When you publish that tool, you get a static list of values that were in the layer/table when you published. New entires won't be shown.
... View more
01-04-2021
02:32 AM
|
1
|
0
|
609
|
POST
|
Hi Joshua, we might not have spelled it out on the tracker, but it is bundled with all the other code and HTML editor issues we have reported.. I will take a look and add it specifically to the tracker for future inquiry! thanks!
... View more
12-30-2020
12:08 PM
|
1
|
0
|
595
|
POST
|
You'll want to remove the extra brackets around coords in view.goTo() because it's already an array from the original assignment.
... View more
12-30-2020
12:00 PM
|
1
|
0
|
2195
|
Title | Kudos | Posted |
---|---|---|
1 | a week ago | |
1 | 02-21-2024 09:50 AM | |
1 | 11-02-2023 09:34 AM | |
1 | 04-19-2022 04:31 PM | |
2 | 02-12-2024 09:21 AM |