|
POST
|
Does the InsertCursor take a lock on the table? If so and the script fails in the for loop, is that lock returned?
... View more
08-03-2020
12:09 PM
|
0
|
3
|
2649
|
|
POST
|
You're looking for those strings ("Batteries;", "Batteries;Disposable Batters;...", etc.) in the category, not the keyword (if(Find(batteryType,cat) >=0)
... View more
06-22-2020
06:10 AM
|
0
|
9
|
6815
|
|
POST
|
I'm still not sure it makes sense to me. The USER_Categ field, to me, looks like what you want to use as the field for your "Unique Values" primary symbology. In your second graphic above where you have the four symbols (Appliances, Asbestos, Airplane, Building Material), you are pointing them one-to-one to values in the USER_Categ field. In which case, I would say to use USER_Categ as the field for your unique symbology, then manually change the label associated with each value to the simplified label ("Appliances" instead of "Appliance Recycling"). If you have too many values to do that manually, Arcade would be the quicker way. I will respond to your post there.
... View more
06-22-2020
06:04 AM
|
0
|
10
|
4039
|
|
POST
|
This is the community for ArcGIS online. The community for ArcGIS Pro might be able to help faster. When you hover over the triangle with the exclamation point beside the symbol for USA Counties, what does it say? Your layers also might be ordered such that the other layers are covering up the ones you're creating. Try dragging the layer you're having trouble with to the top in the contents pane.
... View more
06-19-2020
01:29 PM
|
1
|
0
|
2126
|
|
POST
|
Are you doing that manually in the USER_Categ field, or is that something else? That field looks like it has many fewer unique values.
... View more
06-19-2020
01:20 PM
|
0
|
12
|
4039
|
|
POST
|
Trying testing your regex: "3, 5, 3.9, 12.5 FAR Values" "3, 5, 3.9, 2.5 FAR Values." This is a good case for using regex and a much better solution than the one I provided, but using regex does not mean you shouldn't check for exceptions in type conversions: import arcpy
import re
# find largest number in a string
arcpy.env.workspace = r"D:\APRX_MXDS\USA_App_Project\usa_parcels_with_FARField.gdb"
arcpy.env.overwriteOutput = True
fc = "temp"
with arcpy.da.UpdateCursor(fc, ["FAR_INTEGER", "MAX_VALUE"]) as cursor: # Loop through each feature
for row in cursor:
if row[0] is None: continue
nbrs = []
for i in re.findall('(\d+\.?\d*|\d*\.\d+)', row[0]):
try:
nbrs.append(float(i))
except:
pass
if nbrs:
row[1] = max(nbrs)
cursor.updateRow(row) # if FAR_INTEGER contained no numbers, no need to update That's a slightly improved regex, but I still wouldn't trust it to pass up every erroneous input. You could make an argument to wrap the list assignment in the try statement. But if the regex matches one erroneous input mixed in with some valid inputs, you would get no max value.
... View more
06-18-2020
01:44 PM
|
1
|
0
|
3950
|
|
POST
|
First, there are a number of problems your code: I usually pass the full path to the feature class of a file gdb to UpdateCursor, instead of setting the workspace and passing only the table name. Your method might work, though. I believe the second parameter of UpdateCursor requires an array (["FAR_INTEGER"] instead of just "FAR_INTEGER"). split() only splits strings on whitespace (spaces, tabs, newlines), so you should remove commas row[0].replace(',', '').split(). integer conversion will probably panic if it sees a number with a decimal (e.g. 3.9), so use float conversion instead (float(w) return statements end execution and return that value to the caller. If you want to store the max value, you could put it in a field on that feature class. Then your UpdateCursor call could be UpdateCursor(fc, ["FAR_INTEGER", "max_value"]) and you could use updateRow(row) to store that value. Python indentation separates blocks of code, so both those try statements would be called for every word in every string in every row of the table (if that second try statement didn't guarantee a return which ends execution). Resulting in something like: import arcpy
# find largest number in a string
arcpy.env.workspace = r"D:\APRX_MXDS\USA_App_Project\usa_parcels_with_FARField.gdb"
arcpy.env.overwriteOutput = True
fc = "temp"
with arcpy.da.UpdateCursor(fc, ["FAR_INTEGER", "max_far"]) as cursor:
for row in cursor:
ls = []
for w in row[0].replace(',', '').split():
try:
ls.append(float(w))
except:
pass
try:
row[1] = max(ls)
cursor.updateRow(row)
except:
pass I didn't test that, so I might have introduced more bugs. Now, executing that script is a different topic. What program are you using? I'm most familiar with ArcGIS Pro, in which you should be able to create a new Jupyter notebook (Insert Tab -> New Notebook) and copy-paste it in.
... View more
06-18-2020
12:10 PM
|
0
|
1
|
3950
|
|
POST
|
I originally thought this was a floating point error because when I went to edit the vertex data for the route, the 2282.2725 was actually 2282.27250000001. I have done a number of things to these tables, and now I cannot replicate the issue. One thing I did was change the Rounding Decimal places to 11. I don't really know if that fixed anything, but around the time I made that change the zero length records stopped showing up. However, when I change the rounding back to 6 (where it started), it started missing records that it should have included. Then I restarted ArcGIS Pro and it worked correctly (no zero length lines). I have no idea what is going on any more. Since this post, I have also seen this tool return zero length line events because of ignoring spatial gaps. I was able to recreate my routes with spatial gaps in the m-values, and everything worked properly.
... View more
05-07-2020
08:41 AM
|
0
|
0
|
1488
|
|
POST
|
I am modeling streets in my city with linear referencing in ArcGIS Pro. This is all new to me, so I am not confident I have configured everything correctly. I am seeing what look like zero length events returned from "Overlay Route Events" even though the box is unchecked. My routes were set up such that: Route m values are derived from the length of the features. Route m values ignore spatial gaps. Roads are sectioned off for paving purposes, so that is an event layer without overlap (each section does share a m-value with adjacent sections, though). Construction events, like repaving a road, are an event layer with overlap and without pure overlap to the underlying sections (e.g. a contractor busts a water main and repaves only a part of a section of a road, not the entire section). My goal is to get to an Excel file with data about the sections. I am using the tool "Overlay Route Events" with the "Keep zero length line events" unchecked. I have a construction event on route 0336 from 2282.2725 to 3029.9642. The FromMeasure there, 2282.2725, is the changeover point for the related sections 0336-00 and 0336-01. That is to say it is the FromMeasure for section 0336-00 and the ToMeasure for 0336-01 (sectionIDs were assigned before creating routes, and the tool chose the other direction for m values for this road). When I run "Overlay Route Events", I get the row: OBJECTID RouteID FromMeasure ToMeasure SECTIONID STREETID 123 0336 2282.2725 2282.2725 A033601 0336 I have run this multiple times now, and gotten the same result. The only way I can get this row to not appear is to modify the FromMeasure for the construction event to 2282.2726. Route 0336 is not a multipart feature. Does anyone have a workaround other than not having any of my events share vertices?
... View more
05-07-2020
06:59 AM
|
0
|
1
|
1516
|
|
POST
|
I was working on a fairly new dataset for my organization, so I was able to rapidly change my data model to fit AGOL and make collection easier. The recommendation I got from my ESRI contacts was pretty simply to store what you can in AGOL and have most end users not use Pro. I changed from using the subtypes feature to a domain in AGOL, and I switched from using Collector to Survey123. Survey123 allowed me to mimic subtype domains with a choice_filter. I don't have enough experience with ArcMap or your workflows to be of much help to you. Are there any workflows you can transition to being entirely in an AGOL map?
... View more
04-29-2020
07:25 AM
|
2
|
0
|
13759
|
|
POST
|
From: whereClause = "'ObjectId=" + str(query_result1) + "'" This looks to me like your resulting where clause would be 'ObjectId=49' Try it without the single quotes: whereClause = "ObjectId=" + str(query_result1) In general I prefer the string format so I can better see the final string, but the result should be the same: whereClause = "ObjectId = {0}".format(query_result1) Also depending on your database management system, the case of "ObjectId" ("OBJECTID") might matter. Edit in case anyone else sees this and wonders why I suggested removing the single quotes: I made an assumption that the query function is building a database query by inserting that parameter. A basic query with a WHERE clause might be, "SELECT * FROM working_table WHERE ObjectId = 1". By putting that parameter in single quotes, the query language treats it as a string: "... WHERE 'ObjectId=49'", so it is looking to compare that to a text field in the database. The query language would expect "WHERE 'ObjectId=49' = some_text_field". Different query languages might return all results, return no results, or return an error. That I'm not sure about.
... View more
04-24-2020
08:29 AM
|
1
|
2
|
2293
|
|
POST
|
Here's my experience with subtypes and domains in AGOL/Pro as of 2020-04-20: Subtypes and domains are added to AGOL when publishing from Pro. Neither subtypes nor domains will be visible when viewing that posted layer in Pro. (If you go to the domain tab, it will say something like, "Domains are read-only".) Neither subtypes nor Pro-style domains are easily editable in AGOL. Subtypes are very difficult to edit once published to AGOL because you have to use rest/admin/services and some of the data seems to be in multiple places. You can't edit them from Pro. The domains that are added to AGOL from Pro are different from the "Create List" domain functionality within AGOL. Adding to AGOL from Pro does not automatically create the AGOL-style domain. That means you have to edit the Pro-style domains through rest/admin/services. You can't edit them from Pro. Basic changes to the Pro-sourced domains in AGOL are possible through rest/admin/services. If a domain was used for multiple fields, those changes become more difficult. Pro-Based domains in AGOL are not done intelligently with the domains being a source that the fields reference. Instead, the domains and their values are copied to every field with the same name. So if you change the values for one domain and not the other, AGOL sees the same domain with different values and doesn't work. I haven't tested how AGOL generates lists for a field based on current values (does it read the Pro-style domain or just records the have values?). In short, using subtypes and AGOL doesn't work well. Using domains and AGOL isn't great, but it is manageable. Edit: Additionally, domains and subtypes for AGOL hosted feature layers that you view in Pro aren't visible when editing or viewing records.
... View more
04-20-2020
05:42 AM
|
5
|
2
|
13759
|
|
POST
|
The domains generated by ArcGIS Online have hyphens in them. This Survey123 Quick Reference doesn't exactly say, "Don't use hyphens in choice list_names", but it comes close. I did a very small test where I changed one of my list_choices from "sign_dimensions" to "sign-dimensions", and the choice filter stopped working. I'll go ahead and report this as a bug.
... View more
04-15-2020
06:20 AM
|
0
|
0
|
1551
|
|
POST
|
Sorry, those weren't actually my field names and I didn't realize they were keywords. I just generalized them for the example. I used fields sign_group (type) and sign_type (subtype). I'll edit the original post.
... View more
04-15-2020
05:50 AM
|
0
|
0
|
1551
|
|
POST
|
I posted another question to the community to see if anyone else has seen the issue. I did not reach out to support directly. Admittedly I never watched your full video, but I think what I had been doing was similar (copy the foreign key and primary keys to another GUID and then match them back up after the append). I wasn't ever able to get the GUID type to work, but I was able to copy the primary and foreign keys to string and match them up with a basic script I had written before I knew about your tutorial: import arcpy import os class CustomCancelException(Exception): pass def my_function(post_layer, sign_layer): edit_started = False try: with arcpy.da.SearchCursor(post_layer, ["GLOBALID", "preserve_guid"]) as scur: key_map = {} for srow in scur: key_map[srow[1]] = srow[0] with arcpy.da.UpdateCursor(sign_layer, ["parentfk", "preserve_guid"]) as ucur: for urow in ucur: new_fk = key_map.get(urow[1], None) urow[0] = new_fk ucur.updateRow(urow) except CustomCancelException as err: arcpy.AddError(err) finally: if __name__ == '__main__': post_layer = arcpy.GetParameter(0) sign_layer = arcpy.GetParameter(1) my_function(post_layer, sign_layer) The quotations aren't preserving indentation, but that's the general idea. I never tried copying from a string into a GUID because I thought that wouldn't work and I already had this script.
... View more
04-15-2020
05:41 AM
|
3
|
2
|
6407
|
| Title | Kudos | Posted |
|---|---|---|
| 3 | 08-25-2021 11:09 AM | |
| 1 | 08-16-2021 06:04 AM | |
| 1 | 08-19-2021 12:27 PM | |
| 1 | 08-19-2021 08:15 AM | |
| 1 | 08-13-2021 12:57 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2025
11:23 AM
|