|
POST
|
I'll caution you that an edit session is only required in certain circumstances, and this is probably not one of them. Can you remove anything to do with an edit session and change your calculate field statement to: arcpy.CalculateField_management(WMeter, "WarrantyDate", 'DateAdd("yyyy",20,[InstallDate] )', "VB", "") I assume it's getting hung up on the escaped double-quote inside the statement, but not 100% sure.
... View more
09-19-2018
10:38 AM
|
0
|
2
|
1948
|
|
POST
|
The `fieldnames` list is a list of strings, so its items do not have properties `name` or `type`. You can access the proper items using the list indices: for i in range(len(fieldnames)):
arcpy.AddField_management(newfc, fieldnames[i], fieldtypes[i], "", "", "", "", "", "", "") Better yet, make a dictionary and add both the field name and type to each item in order to concretely associate them.
... View more
09-19-2018
09:24 AM
|
1
|
1
|
3993
|
|
POST
|
Please format your code for readability: /blogs/dan_patterson/2016/08/14/script-formatting I assume your code is failing at: for fc in fcList: Try printing fcList to see if it's empty. I suspect it's because your path isn't a raw string (backslashes in paths are bad). Try: arcpy.env.workspace = r"C:\EsriTraining\Python10_0\Data\SanJuan.gdb" If none of this helps, please format your code and indicate where the error occurs. edit: this line is surely wrong: arcpy.Buffer()
... View more
09-18-2018
03:57 PM
|
3
|
10
|
6490
|
|
POST
|
In Python, you would find the Point Geometry you moved, then cycle through the Polygon objects, checking if the polygon contains the point (using one of the polygon methods, like contains or not disjoint). The JS API would have similar objects/methods, but I'm not particularly familiar with it.
... View more
09-12-2018
04:42 PM
|
1
|
0
|
2165
|
|
POST
|
Are you hoping for a Python or JS solution, or something else?
... View more
09-12-2018
01:58 PM
|
0
|
2
|
2165
|
|
POST
|
I guess triple quotes are the recommended method. Try: select = """SITE_ID = '{}'""".format(i) From: Specifying a query in Python—ArcPy Get Started | ArcGIS Desktop
... View more
09-11-2018
02:18 PM
|
0
|
1
|
1736
|
|
POST
|
Honestly, I don't know. You can try, but I assume it won't let you because there is already a feature class inside with a different CRS. I'd make a new feature dataset with the desired CRS, if you indeed need a feature dataset.
... View more
09-11-2018
11:03 AM
|
1
|
3
|
1312
|
|
POST
|
Your feature dataset has a set CRS, and all feature classes within it must share that same CRS. An overview of working with feature datasets—Help | ArcGIS for Desktop I should ask: are you saving the reprojected feature class within the feature dataset? You would have to save it outside the feature dataset, which has the other CRS already set.
... View more
09-11-2018
10:51 AM
|
1
|
5
|
1312
|
|
POST
|
It's single quotes around strings. Best guess: sql = "STATE_NAME = '{}'".format('California')
print(sql)
STATE_NAME = 'California' Bookmark: SQL reference for query expressions used in ArcGIS—ArcGIS Pro | ArcGIS Desktop
... View more
09-10-2018
03:45 PM
|
1
|
3
|
1736
|
|
POST
|
My guess is that you're looking to set a definition query, which creates a filtered view of your data. The features that meet the query criteria are shown on the map and table, but all the features remain in the feature class. Alternatively, you may want to change the layer symbology to only display the relevant points, keeping everything in the attribute table, but only displaying the features you want. You will not be able to delete a geographic feature and keep the table record, however. edit: reading through your link, it appears it may be possible, but my opinion is that it's a hacky way to organize your data.
... View more
09-10-2018
01:30 PM
|
1
|
0
|
2584
|
|
POST
|
Without specifically coding each requirement, you could look into running Minimum Bounding Geometry (RECTANGLE_BY_AREA) to create a rectangle for each feature, and select those meeting some threshold (e.g. 99% of area). The more rectangular the feature, the closer it will match the minimum rectangle.
... View more
09-10-2018
10:15 AM
|
1
|
1
|
3160
|
|
POST
|
If I understand correctly, you can load your data into a list and select those that return 'true': l = [4.035, 4.066, 3.604, 3.576, 4.593, 2.690, 2.960, 4.59]
def compare(val_1, val_2, cur):
diff = abs(val_2 - val_1)
thresh = cur * 0.2
diff_minus_thresh = diff - thresh
if diff_minus_thresh > 0:
sel = True
else:
sel = False
return (l[i], diff, thresh, diff_minus_thresh, sel)
print('COMPARE BACKWARD')
for i in range(1, len(l)):
print(compare(l[i-1], l[i], l[i]))
print('COMPARE FORWARD')
for i in range(0, len(l)-1):
print(compare(l[i], l[i+1], l[i]))
COMPARE BACKWARD
(4.066, 0.030999999999999694, 0.8132, -0.7822000000000003, False)
(3.604, 0.46199999999999974, 0.7208000000000001, -0.25880000000000036, False)
(3.576, 0.028000000000000025, 0.7152000000000001, -0.6872, False)
(4.593, 1.017, 0.9186000000000001, 0.09839999999999982, True)
(2.69, 1.903, 0.538, 1.365, True)
(2.96, 0.27, 0.592, -0.32199999999999995, False)
(4.59, 1.63, 0.918, 0.7119999999999999, True)
COMPARE FORWARD
(4.035, 0.030999999999999694, 0.807, -0.7760000000000004, False)
(4.066, 0.46199999999999974, 0.8132, -0.3512000000000003, False)
(3.604, 0.028000000000000025, 0.7208000000000001, -0.6928000000000001, False)
(3.576, 1.017, 0.7152000000000001, 0.30179999999999985, True)
(4.593, 1.903, 0.9186000000000001, 0.9843999999999999, True)
(2.69, 0.27, 0.538, -0.268, False)
(2.96, 1.63, 0.592, 1.0379999999999998, True)
... View more
09-07-2018
02:42 PM
|
2
|
0
|
3132
|
|
POST
|
See example #2 here for how to read all records into a list, then access items by index (or similarly read into a dictionary and access by key): SearchCursor—Data Access module | ArcGIS Desktop
... View more
09-07-2018
12:55 PM
|
0
|
1
|
3132
|
|
POST
|
Unless you specifically ask for the exception, the error message won't be displayed - that's the point of try/except: foo = 'a'
bar = 1
try:
concat = foo + bar
except Exception as e:
print(e)
must be str, not int Of course, you may have this, but we can't see your try/except statement.
... View more
09-07-2018
10:43 AM
|
1
|
0
|
1535
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM | |
| 2 | 07-16-2020 11:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|