POST
|
Parsing rhinoceros sightings Challenges The rhinos in the spreadsheet appear in no guaranteed order, and not all the rhinos appear at the beginning of the spreadsheet. As I parse each line, I must determine which rhino the reading belongs to and update that rhino's polyline track accordingly. I am not allowed to sort the Rhino column in Excel before I export to the CSV file. My script must be "smart" enough to work with an unsorted spreadsheet in the order that the records appear. I do not immediately know how many rhinos are in the file or even what their names are. Although I could visually comb the spreadsheet for this information and hard-code each rhino's name, your script is required to handle all the rhino names programmatically. The idea is that I should be able to run this script on a different file, possibly containing more rhinos, without having to make many manual adjustments. If I do things right, my polylines should look like this (points are included only for reference): I'm having the most problems with the dictionaries part of my code so far but no luck: rhinoName = {('Rhino'):(Rhino, array)}: for each Rhino in rhinoname: dictionary[rhinoName].append([latValue, lonValueIndex]) if rhinoName not in dictionary: dictionary[rhinoName] = [] else: dictionary[rhinoName]= ([latValue, lonValue])
... View more
11-27-2011
06:58 AM
|
0
|
3
|
1751
|
POST
|
Thank you. I'm not sure how to do the write the script to calculate the "SHAPE_Area/2589988.11" and then take that value and divide the # of incidents by it?
... View more
11-05-2011
12:23 PM
|
0
|
0
|
294
|
POST
|
Hi I need help with writing a script: The task I have a point feature class of graffiti incidents and a polygon feature class of patrol zones with some empty attributes already created for you. I must write a script that updates the attributes of the patrol zones with: ??? The number of graffiti incidents falling within the patrol zone. This is an integer that goes in the INCIDENTS field. ??? The priority ranking for the patrol zone. This is a string that goes in the PRIORITY field. You will derive this string using some simple math that compares the number of incidents in the zone with the area of the zone. Patrol zone priority rankings I then will calculate a priority ranking for each zone by dividing the number of graffiti incidents in the zone by the area of the zone. My script should then examine the result and assign the appropriate priority ranking (PRIORITY). These are the priority rankings: ??? TOP CONCERN???15 or more incidents per square mile ??? HIGH CONCERN??? At least 12 but less than 15 incidents per square mile ??? SOME CONCERN??? At least 6 but less than 12 incidents per square mile ??? LOW CONCERN???Fewer than 6 incidents per square mile Here's what I have so far: import arcpy arcpy.env.overwriteOutput= True # layer that we are changing patrolZone= "C:\\...\\PoliceData.gdb\\PatrolZones" # the layer we are selecting from graffiti= "C:\\...\\PoliceData.gdb\\GraffitiIncidents" nameField= "NAME" graffitiField= "OBJECTID" incidentsField= "INCIDENTS" # sits above the first row, starts the cursor patrolRows= arcpy.UpdateCursor(patrolZone) # tells it to go to the first row patrol= patrolRows.next() # now were in the first row doing looping while patrol: arcpy.MakeFeatureLayer_management(graffiti, "GraffitiLayer") zones= patrol.getValue(nameField) #print incidents queryString = '"' + str(nameField) + '" = ' + "'" + str(zones) + "'" print str(queryString) arcpy.MakeFeatureLayer_management(patrolZone, "PatrolLayer", queryString) arcpy.SelectLayerByLocation_management("GraffitiLayer", "CONTAINED_BY", "PatrolLayer") numGraffiti= arcpy.GetCount_management("GraffitiLayer") print numGraffiti patrol= patrolRows.next() I would appreciate any help!!
... View more
11-04-2011
08:31 AM
|
0
|
2
|
487
|
POST
|
I'm trying to perform a hot spot analysis on road kill point data and I am not sure how to do this. I know there are many tools in the Spatial Statistic Tools and also the Spatial Analysis tools, but not quite sure which tool to use. I just want to determine the clusters or hot spots of the points for road kill.
... View more
10-31-2011
03:37 PM
|
0
|
2
|
657
|
POST
|
I'm trying to perform a hot spot analysis on road kill point data and I am not sure how to do this. I know there are many tools in the Spatial Statistic Tools and also the Spatial Analysis tools, but not quite sure which tool to use. I just want to determine the clusters or hot spots of the points for road kill.
... View more
10-31-2011
11:13 AM
|
0
|
1
|
353
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|