Java Reference
In-Depth Information
Figure 3.3. The Groovy script for accessing the Google V2 geocoder
Running this script requires me to supply the street, city, and state information, and then
retrieve the output latitude and longitude. I want to use Java to supply the input values and
process the output, but first I'll show a typical result, which can then be used as a test case.
To avoid being too U.S.-centric I'll use the address for the Royal Observatory in Green-
wich, England. That makes the values for street , city , and state “Blackheath Aven-
ue,” “Greenwich,” and “UK,” respectively. [ 5 ] Executing the script results in the output
5 Clearly the word “state” is to be interpreted broadly. Supply a country name for state, and it works all over the
world.
(code,level,lat,lng) = (200,6,51.4752654,0.0014324)
TheRoyalObservatorywasoriginallythearbitrarilychosenlocationoftheprimemeridian,
so the value of the longitude should be pretty close to zero, and it is. The input address
isn't as precise as it might be, and the observatory address doesn't define the actual prime
meridian any more, but the results are pretty impressive anyway. The resulting test case as
part of a JUnit 4 test is shown in the next listing.
 
 
Search WWH ::




Custom Search