My PSET8 function for Pickup seems to work perfectly except that I can pickup the same student multiple times. The way I understood it, once the placemark is removed,
PASSENGERS.placemark for that specific student shouldn't exist, and therefore, when I calculate the distance, there should be nothing to calculate and the student shouldn't be within range. This clearly does not seem to be the case, since I am continuing to pick up the student and can even access that value in the Console.
I have a few workaround solutions, but I would rather understand conceptually what I am doing wrong. If the placemark has been removed, why are it's coordinates still attainable? I removed it visually on Google Earth and Google Maps so something must have changed...
- After removing the placemark from GE, implicitly set the coordinates to null.
- Make a condition that will check if the individual is already in the car and if so not add their information to the roster. This will however become a problem if someone clicks the pickup button in the location where a placemark once was AFTER already dropping off that individual.