POST
|
once again, THANKS! SplitByAttribute does exactly what I was hoping to accomplish--in a single line; without needing to employ a SearchCursor. More than 1 thumb up emoji! Thanks, Dan!
... View more
12-02-2021
08:06 PM
|
0
|
0
|
1867
|
POST
|
Hi, I am trying to populate a field for lines that are separated by another point feature class. However, some lines shares common vertex coordinates but not with the point feature class. So the number of shared vertices can range anywhere from 2 - 5 lines. I have a script that generates a unique ID based on a random number, but what I am struggling with is how to go about it. I am also trying to keep it as light as possible without needing to create another feature class. Here is what I have thus far. (also, I keep getting the error message 'dictionary changed size during iteration' error message) import arcpy
import random
import time
start_time = 'Process start time: {}'.format(time.strftime('%I:%M:%S'))
print (start_time)
#arcpy.env.overwriteOutput = True
# Input parameters
#InputFolder = r'*'
spointFc = r'*'
LineFc = r'*'
# Describe input features
##desc = arcpy.Describe(LineFc)
##Geometry = desc.shapeType
# Create separate folder and database
#- Create folder if folder does not
#- exist.
##Folder_Name = 'Storage Folder'
##Folder = os.path.join(Folder_Name, InputFolder)
##
##Created_Folder = ''
##for root, directory, folders in os.walk(InputFolder):
## for folder in folders:
## if folder == Folder_Name:
## Created_Folder = os.path.join(folder, root)
## else:
## Created_Folder = os.mkdir(Folder_Location)
#- Create geodatabase if geodatabase does
#- not exist.
##Created_GDB_Name = 'DataHolding.gdb'
##Created_GDB = os.path.join(Created_GDB_Name, Created_Folder)
##
##Created_Geodatabase = ''
##for root, directory, folders in os.walk(Created_Folder):
## for folder in folders:
## if folder == Created_GDB_Name:
## Created_Geodatabase = os.path.join(folder, root)
## else:
## Created_Geodatabase = arcpy.CreateFileGDB_management(Created_Folder, Created_GDB_Name)
# Set newly created file geodatabase
# as the new workspace.
##arcpy.env.workspace = Created_Geodatabase
# Gather fields for searching through
# and updating each feature class.
SelectspointFc_Fields = [field.name for field in arcpy.ListFields(spointFc) if field.name in ['OBJECTID', 'IsolationIDA', 'IsolationIDB']]
SelectLineFc_Fields = [field.name for field in arcpy.ListFields(LineFc) if field.name in ['OBJECTID', 'IsolationID']]
AddspointShape_Field = ['SHAPE@XY']
AddLineShape_Field = ['SHAPE@']
spointFc_Fields = SelectspointFc_Fields + AddspointShape_Field
LineFc_Fields = SelectLineFc_Fields + AddLineShape_Field
# Define the update and search cursors for
# input features.
updatepoints = arcpy.da.UpdateCursor(spointFc, spointFc_Fields)
updateLines = arcpy.da.UpdateCursor(LineFc, LineFc_Fields)
searchpoints = arcpy.da.SearchCursor(spointFc, spointFc_Fields)
searchLines = arcpy.da.SearchCursor(LineFc, LineFc_Fields)
# Loop through the line feature class and
# update based on whether the IsolationID
# is null.
#LineID = {}
IsolatedIDs = {}
#SharedCounts = {}
UpdateIsolatedIDs = {}
valve_points = []
NoneValvePoints = []
startloop_pointFC = 'Starting point feature class loop at {}'.format(time.strftime('%I:%M:%S'))
print (startloop_pointFC)
for point in searchpoints:
if point[-1] not in valve_points:
Vpoint = [x for x in point[-1]]
#print (Vpoint)
valve_points.append(Vpoint)
stoploop_pointFC ='Finished point feature class loop at {}'.format(time.strftime('%I:%M:%S'))
print (stoploop_pointFC)
startloop_lineFC = 'Starting line feature class loop at {}'.format(time.strftime('%I:%M:%S'))
print (startloop_lineFC)
for line in searchLines:
i = 0
IsolationID = random.randint(10000000, 99999999)
ID = line[0]
startpnt = line[2].firstPoint
start = [startpnt.X, startpnt.Y]
endpnt = line[2].lastPoint
end = [endpnt.X, endpnt.Y]
start_end = [start, end]
UID = {ID: start_end}
if start in valve_points and end in valve_points:
UpdateIsolatedIDs[ID] = IsolationID
#print (IsolationID, ID)
elif start in valve_points and end not in valve_points:
if end not in NoneValvePoints:
NoneValvePoints.append(end)
elif end in valve_points and start not in valve_points:
if start not in NoneValvePoints:
NoneValvePoints.append(start)
else:
if start in NoneValvePoints and end in NoneValvePoints:
if IsolatedIDs:
for A, B in IsolatedIDs.items():
if start not in B and end not in B:
IsolatedIDs[IsolationID] = start_end
else:
IsolatedIDs[IsolationID] = start_end
print (IsolationID, start_end)
elif start in NoneValvePoints and end not in NoneValvePoints:
NoneValvePoints.append(end)
if IsolatedIDs:
for A, B in IsolatedIDs.items():
if start in B and end not in B:
update = B + [end]
IsolatedIDs[A] = update
elif start not in B and end in B:
update = B + [start]
IsolatedIDs[A] = update
else:
IsolatedIDs[IsolationID] = start_end
print (IsolationID, start_end)
elif end in NoneValvePoints and start not in NoneValvePoints:
NoneValvePoints.append(start)
if IsolatedIDs:
for A, B in IsolatedIDs.items():
if start in B and end not in B:
update = B + [end]
IsolatedIDs[A] = update
elif start not in B and end in B:
update = B + [start]
IsolatedIDs[A] = update
else:
IsolatedIDs[IsolationID] = start_end
print (IsolationID, start_end)
else:
NoneValvePoints + start_end
if IsolatedIDs:
for A, B in IsolatedIDs.items():
if start not in B and end not in B:
IsolatedIDs[IsolationID] = start_end
else:
IsolatedIDs[IsolationID] = start_end
print (IsolationID, start_end)
stoploop_lineFC = 'Finished line feature class loop at {}'.format(time.strftime('%I:%M:%S'))
print (stoploop_lineFC)
startloop_dict = 'Starting dictionary loop at {}'.format(time.strftime('%I:%M:%S'))
print (startloop_dict)
for A, B in IsolatedIDs.items():
print (A, B)
finishloop_dict = 'Finished dictionary loop at {}'.format(time.strftime('%I:%M:%S'))
print (finishloop_dict)
finish_time = 'Process finish time: {}'.format(time.strftime('%I:%M:%S'))
print (finish_time) I have also tried creating dictionaries within a single dictionary using the isolatedID as the key with another dictionary, created using the line ID and start and end vertices, as the value. Any help on this would be greatly appreciated. I will keep on trying but I have been struggling for quite some time with this.
... View more
11-29-2021
09:23 AM
|
0
|
0
|
352
|
IDEA
|
Depending on your workflow, you could potentially add numeric fields to each layer with the desired weighting value, then use Overlay Layers - Intersect for successive pairs of input layers/results. Once all have been combined, create a new field and use Calculate field to combine the weightings as desired. But the best approach would probably be to use the Feature to Raster tool and then perform a Weighted Overlay of those newly created rasters.
... View more
11-26-2021
06:49 AM
|
0
|
0
|
583
|
POST
|
I can understand why it would be confusing when only 'some' relationship classes have this context menu to add to map. Only certain types of relationship classes will have the right-click context menu to add to a map. Many-to-many relationship classes have an intermediate table and will have the context menu to add to the map - they'll show up as tables. These are also referred to as attributed relationship classes. Here is some supporting documentation for preparing data that mentions attributed relationship classes needing to be present in the map document. Prepare data to publish a feature service Feature services allow queries on related data, but only if the relationship is defined through a geodatabase relationship class. If a published map document has a layer and table related through a geodatabase relationship class, the feature service allows queries on the layer to return objects from the related table. To support queries that return related objects, you must include the table and layer involved in the relationship class in the published map document. If either the origin or destination layer or table is not included in the map document, the feature service ignores the relationship. Note: For attributed relationship classes, include the relationship class table in the map document.
... View more
11-17-2021
07:07 AM
|
0
|
0
|
2571
|
IDEA
|
I have been thinking about this for quite some time, but I thought it would be very helpful if there was an application created specifically for scheduling either scripts, processes, field calculations, or updates to feature layers published either as hosted or from a server, where the user(s) can schedule tasks similar to windows task scheduler but as an Esri Application. I have noticed that there are a lot of people who need to understand programming or have certain permissions to utilize windows task scheduler. So I thought it would be a massive help if an online Esri application designed specifically to set scheduled tasks is something that could be created.
... View more
11-05-2021
05:09 AM
|
0
|
0
|
395
|
POST
|
This is a different question you are asking and strongly demonstrates why you should always include images in your question so it very clear what you are asking (may be you should go back and edit your question and include an image?). Your original questions asks: finds all the lines that were digitized outside a grid polygon layer Well my simple solution finds all the lines outside the polygons. You now seem to be asking to: find all portions of lines outside the polygons. This includes whole polylines and parts of a polyline that originated from within the polygons but are outside the polygon. The erase tool would certainly achieve this, deleting the portions of lines within the polygons but be aware that this is an advance level licensed tool and if you plan to distribute your tool you need to state this in any documentation to stop people with the incorrect license using it.
... View more
10-28-2021
02:03 AM
|
0
|
0
|
1002
|
IDEA
|
I think that it would be a huge help if attribute rules could be instilled with the option for a check box to update using 'Real Time'. Meaning that if that option is checked, regardless of the feature being published or not, that the feature would update based on real time. It seems rather strange that only a few triggers exist currently for attribute rules (Insert, Update, Delete), but having the option of selecting real time would be extremely helpful.
... View more
10-26-2021
09:48 AM
|
1
|
0
|
287
|
IDEA
|
Hi, I have noticed that, in the web maps, that users can create custom fields based on arcade expressions which shows as temporary field(s). However, those fields are only shown in the web map and cannot be used for setting a filter on the layer. It would be very helpful if a temporary field can be added that updates attributes in real time and be able to filter based on that attribute value. Another option would also be for hosted feature services to have the ability to have fields created, based on an arcade expression, and used in the web map with full functionality. If this already exists and I simply overlooked it, please let me know. Otherwise, I hope that this is something that can be implemented because it can be used for a multitude of the projects that I work on.
... View more
10-25-2021
12:43 PM
|
4
|
0
|
593
|
IDEA
|
Hi, I have a custom solution, designed using WAB in ArcGIS Online, which utilizes the Query Widget. I noticed that there isn't an option in the widget settings that allows for a predefined spatial relation in the widget. For what I am trying to do, it would be really helpful if a spatial relation could be set for when the users utilize the widget.
... View more
10-21-2021
11:18 AM
|
1
|
0
|
239
|
POST
|
hi @Luke_Pinner, I was simply asking out of curiosity. I wasn't necessarily planning on going in that direction without checking with someone who is more knowledgeable than I. I am glad that the documentation that you provided outlined the different setups in regards to namespaces. I am relatively new to scripting functions and classes, so I do not have quite a strong grasp of such concepts. I will have to do some more research to figure out which direction would be best to take as well as experiment to see how script will behave. There is still a lot of material in regards to all of the intricacies and functionalities of python as it pertains to GIS. I am still trying to learn what is best practice and I check with the community frequently when I don't fully understand something.
... View more
10-19-2021
07:05 AM
|
0
|
0
|
3634
|
POST
|
Glad to hear it helped. I was thinking that maybe I should have posted a snippet from the execute function where the code sections are conditioned on the associated checkbox being enabled, but it looks like you got the idea OK
... View more
10-15-2021
08:02 AM
|
0
|
0
|
462
|
POST
|
I think they are supported or there is something else that is happening in the background that is occurring. I have a hosted feature service, and the service is currently working where the attribute value changes according to the rule that I set up.
... View more
10-08-2021
07:28 AM
|
0
|
0
|
712
|
POST
|
Other than scheduling a python script to run periodically, I know of no way to do that completely automatically. I think the Attribute Rule approach comes pretty close. All you have to do to execute it is insert a new feature or update an existing one.
... View more
09-30-2021
10:56 PM
|
0
|
0
|
1751
|
POST
|
@helenchu The Smart Editor widget in Web AppBuilder now supports creating points from polygons. Please see this blog: What’s New in the Smart Editor widget (June 2021) (esri.com) Although it does require user input by selecting the features to be copied into the target point layer and it's not an automated process.
... View more
09-27-2021
12:13 PM
|
1
|
0
|
1494
|
POST
|
Might be, not sure, I would choose what is working and get the job done Regards Ihab
... View more
09-22-2021
02:36 PM
|
0
|
0
|
523
|
Title | Kudos | Posted |
---|---|---|
1 | 11 hours ago | |
1 | 2 weeks ago | |
2 | 2 weeks ago | |
4 | 3 weeks ago | |
1 | a month ago |