via the Google Maps API Google Group:
I'm the developer of the US Voter Info mapplet and gadget (the front end,
not the API). I'd be happy to answer any questions about it.
I don't know of any public documentation on the polling place API either.
There is an internal document - I'll find out if it can be released. As
Barry mentioned, you can use Firebug or (my favorite) the Fiddler debugging
proxy server to scope out how the mapplet and gadget call the polling place
API.
You can also get the source code for the mapplet and gadget and see how it
works. The code is here:
http://code.google.com/p/election-maps-2008/source/browse/
Or:
http://code.google.com/p/election-maps-2008/source/checkout
The main source code is in poll411-map.js. The mapplet is
poll411-mapplet-gc.xml and the gadget is poll411-gadget.xml.
The code goes through several steps to get the polling place info. The
polling place API is fairly strict about the address formats it will accept,
and the addresses it gives back come in several different formats. Some have
a complete address, others have only the street address and maybe the city
or maybe not. (This isn't the fault of the API; different states provided
data in different formats and various degrees of completeness.) So the
mapplet code does this:
1) It geocodes the address you enter, both to get the lat/long and more
importantly to get a more complete, cleaned up version of your address.
2) It passes the cleaned-up address to the polling place API.
3) If it gets back a single valid result, it inspects the returned address
to see if it has anything that looks like either a zip code or a valid state
abbreviation. If those are missing, then the code appends the city and state
that it got from step 2 (the assumption being that the polling place is in
the same city as your home).
4) Finally, it runs the resulting address through the geocoder again, to get
a cleaned-up version of that address along with its lat/long.
To find the relevant code in the mapplet, look for the geocode() and
lookup() functions that do the basic geocoding and polling place lookup, and
the findPrecinct() function that puts it all together.
Hope that helps, give me a shout with any questions...
-Mike
Comments (0)
You don't have permission to comment on this page.