Speedfreak has asked for the wisdom of the Perl Monks concerning the following question:
Hej All,
One day I am going to get this nailed but until then, can someone please guide me in the ways...
Heres the problem:
I have a CSV file which contains a list of places plus there position on the planet in Latitude and Longtitude stored as decimal.
Now, the prinicpal is to select one of these locations and return a list of places within a defined square area of a certain size.
First problem is that I have to open this CSV file and search it for the place selected to get its Lat/Lon pair. I then have to re-search it for all the places who's position is close based on the search area.
My theory was to create a 2 dimensional array (sort of rows/cols if you will), by reading lines in, splitting them by the delimeter and putting the values in the second dimension. I would then index a line by the first.
However, reading my Perl docs and books I have, I cant seem to find how to do this.
However I do it I need to complete the following steps.
1) Open the CSV file and pull it into an array.
2) Go through each element of the array to find a matching place name and then get its Lat/Lon from a column on that row.
3) Re-search the array for places who's position lies within a predefined area around the chosen place.
Can anyone advise me on this? I am completely lost and dont want to have to parse a file from disk twice and putting it into an array and searching it twice seems to me to take less disk overhead than using a simple SQL query.
- Jed
|
---|