How can I get a list of all transit stations currently on a map, of which the icons are actually visible?
I've tried doing this with the Places API, but the Places API has a couple of fundamental flaws that cannot be worked around:
- It can (and does) return multiple places in almost ("almost" is the problem) the exact same location, one in English and the other in the local language, but with no way to tell which is which.
- It doesn't and cannot know about the map's zoom level. Therefor is will happily return places that aren't visible on the map when the zoom level is low enough.
- The most likely candidate for returning anything usable, is the Radar Search. Problem is, the radar search doesn't return even the name of places. So even a hover on any returned place must do an additional call, adding to the daily limit very quickly. The Nearby Search is another candidate, and while it returns more data per place, it returns fewer places per "page", requiring many requests after each pan/zoom....
So, the Places API looks very promising, but fails to deliver on the details.
Google Maps, the website, has somehow solved this. Not with the Places API, unsurprizingly, but with something else. It's doing a lot of very weird requests to a url that is undocumented. And the result too seems like they're making it very hard for themselves to parse it. Nevertheless, it seems like it's what I need. Or something like it.
Here's a test case that proves the Places API isn't good enough. Just pan around, zoom in/out and you'll see it failing. http://home.thany.nl/apps/MYMaps/test2.html