|
|
|
|
|
by dmcginty
1802 days ago
|
|
I was in a job interview several years ago and I was given the following prompt: "You have a database containing locations with their corresponding latitudes and longitudes. We want to be able to input an arbitrary latitude and longitude and have the program return all locations within a radius from that point from the database." My initial reaction was to say "I would use a GIS library/API", but the interviewer wanted me to come up with the algorithm on my own. I had done some GIS work at a previous job, so I started explaining how I'd approach it. I was a bit rusty, but I started explaining what I could remember about the Haversine formula and rhumb lines. The interviewer told me that I was overcomplicating it and explained that I can treat the latitude and longitude as standard Cartesian coordinates. I explained how that wouldn't work as they're spherical coordinates, not planar, and lines of longitude aren't parallel. I believe this is where the problem went from being an issue with technical approach to an issue with expectations. What they really wanted was an algorithm that could find all points a given radius from an arbitrary X,Y coordinate. However, by trying to turn it into a real-world problem with latitudes and longitudes they neglected to consider that they had fundamentally changed the challenge. I'm quite stubborn, and I tried to point out that the question was much more difficult than they intended, but they were equally stubborn and insisted that spherical coordinates could be directly converted to planar coordinates with no issue. Long story short, I didn't get a call back and I'm still frustrated about that interview ~3 years later, but I'm also glad that I stood my ground rather than give an incorrect answer. |
|