|
POST
|
This worked, although would it be best to do just do it through Calculate field management.
... View more
08-31-2020
01:52 PM
|
0
|
0
|
971
|
|
POST
|
I have but for some reason it won't work no matter how many spaces(indents) I put in, in line 6 gives me the same error.
... View more
08-31-2020
01:12 PM
|
0
|
0
|
2039
|
|
POST
|
I am getting error 000989. If and else have two indent and the return have 4 indents. Field Calculator import string
nums = string.digits
def conv( WellID , nums):
"""docstring"""
if !WellID! [-2] in nums: # two space indents
return "{} {}".format( !WellID! [1:-2], !WellID! [-1:])#four spaces indents
else: # two space indents
return !WellID! [1:]#four spaces indents Code Block def conv( WellID , nums)
... View more
08-31-2020
10:06 AM
|
0
|
5
|
2039
|
|
POST
|
I am kind of lost on this one because it's not formatted with updatecusror, can you explain what's going on please?
... View more
08-28-2020
01:38 PM
|
0
|
7
|
2039
|
|
POST
|
I am getting error string index out of range on line 5. Also the "_" to " " because i need the space not the underscore. dict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(fc,['WellID','WPin'])}
with arcpy.da.UpdateCursor(fc,['WellID','WPin']) as cursor:
for row in cursor:
if row[0][10] == '0':
#print(row[0][:9]+"_"+row[0][-1:])
row [1] = row[0][:9]+" "+row[0][-1:]
else:
print(row[0])
cursor.updateRow(row)
... View more
08-28-2020
01:36 PM
|
0
|
0
|
2039
|
|
POST
|
Trying to format a field but I am not sure how accomplish it. The trouble I am having is the making the second to last 0 a space but only if there is no alph char. WellPin field is always 10 numbers and sometimes with an alph char. Can someone help me out by showing me how to do this with updatecurosr and in a filed calculator please? Well WPin W1234500000 --> 12345000 0 W1234501000--> 12345010 0 W12345010S0--> 12345010S0 W12345010S1--> 12345010S1 Here what I have so far. import arcpy
arcpy.env.overwriteOutput = True
fc = r"C:\Temp\Wells.shp"
count = 0
def maketv_cursor(fc):
rows = arcpy.SearchCursor(table,"WPin")
count = 0
for row in rows:
count += 1
#print(count)
with arcpy.da.UpdateCursor(fc,['WellID','WPin']) as cursor:
for row in cursor: #if row[0] in (None, "", " "):
row [1] = (row[0][1:11]) # Field Calculator!WellID! [1:11]
cursor.updateRow(row)
... View more
08-28-2020
11:57 AM
|
0
|
16
|
3176
|
|
POST
|
Thanks but after running the code with your suggestion it takes 1.48 min,sec to only select one feature. The following only copies one feature. print, prints 1 over and over 1 1 1 1 arcpy.MakeFeatureLayer_management(fc, 'FcLyr')
#oids = [row[0] for row in arcpy.da.SearchCursor('FcLyr', "OID@")]
with arcpy.da.SearchCursor('FcLyr', ["OID@"]) as selected_fc:
for row in selected_fc:
#print (row)
arcpy.SelectLayerByAttribute_management('FcLyr', "NEW_SELECTION", "OBJECTID_1 = {}".format(str(row[0]))) #"OBJECTID_1 = {}".format(row[0])
result = int(arcpy.GetCount_management('FcLyr').getOutput(0))
print (result)
arcpy.CopyFeatures_management('FcLyr', "C:/Temp/blah/blah.gdb/blah")
... View more
08-24-2020
08:39 AM
|
0
|
1
|
3634
|
|
POST
|
I didn't think of that but I am still curious on how you would do that with selectbyattributes or other ways.
... View more
08-20-2020
03:17 PM
|
1
|
0
|
3634
|
|
POST
|
I am trying to select all the features/attributes of a feature class but I am unable accomplish this, can someone help me out. I have tried the following but i get arcgisscripting.ExecuteError: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute)." on line 6. If this is not the best/easiest way please share what would be. arcpy.MakeFeatureLayer_management(fc, 'FcLyr')
#oids = [row[0] for row in arcpy.da.SearchCursor('FcLyr', "OID@")]
with arcpy.da.SearchCursor('FcLyr', ["OID@"]) as selected_fc:
for row in selected_fc:
print (row)
arcpy.SelectLayerByAttribute_management('FcLyr', "NEW_SELECTION", row[0]) #"OBJECTID = {}".format(row[0])
... View more
08-20-2020
02:19 PM
|
0
|
8
|
3806
|
|
IDEA
|
I was able to figure it out but my zoom is not working, no matter what I change the lvl to 1-20 nothing ever happens, anyone have any idea as to why the lvl doesn't work? "https://www.bing.com/maps?&style=o&lvl=20&dir=0&cp=" + text(Latitude) + "~" + text(Longitude);
... View more
08-18-2020
01:55 PM
|
0
|
0
|
2461
|
|
POST
|
Thank for sharing. Can you explain what lines 11-19 are doing please?
... View more
08-17-2020
01:24 PM
|
0
|
1
|
2968
|
|
IDEA
|
I am trying to use the "Dynamically create a hyperlink with lat long values in a popup" from github and trying to use the Google Panoramic but when the code and click on the map I get a popup and it's just black, not sure what the issues is? Also can it be changed to add Bings Birds view, if so how?
... View more
08-17-2020
09:41 AM
|
0
|
0
|
2461
|
|
POST
|
Data is in a feature class in a fgdb. I want to be able to see how many times an attribute is duplicated in a the field well_Id but I don't need all of them to have a number in the Dup filed but if that is the only way then that is ok. How do I take k & n and write to the feature class thought update cursor?
... View more
08-17-2020
07:46 AM
|
0
|
3
|
2969
|
|
POST
|
Yes something similar to how the Google panoramic, but instead of good maps it would open Bing Birds view for the location where you clicked on.When testing the Dynamically create a hyperlink with lat long values in a popup, panoramic view I don't see the picture it's just black, is there a reason why?
... View more
08-14-2020
01:52 PM
|
0
|
0
|
1156
|
|
POST
|
How do reading the valuse from a dictionary use dict for with arcpy.da.UpdateCursor?
... View more
08-14-2020
10:34 AM
|
0
|
5
|
2969
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-01-2024 07:19 AM | |
| 1 | 07-26-2024 09:38 AM | |
| 1 | 01-08-2024 09:44 AM | |
| 1 | 03-07-2023 11:46 AM | |
| 1 | 11-02-2020 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-14-2025
07:49 AM
|