caligrl

assignment

Discussion created by caligrl on Nov 27, 2011
Latest reply on Oct 8, 2013 by JScheirer-esristaff
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])

Outcomes