20210525 The geocode command takes a supplied address and produces specific location details.
$ ml geocode google [options] <address> -b --google Generate Google Maps URL. -g --google Generate Google Maps URL. -m <int> --max=<int> Maximum number of matches. -o --osm Generate Open Street Map URL. -u --url Generate Open Street Map URL.
The output, separated by commas, consists of the latitude:longitude (north/south : east/west) location, a bounding box for the region (south latitude : west longitude : north latitude : east longitude), the confidence that the identified location is a match, a match code (good, ambiguous, uphierarchy), the entity type. The remaining output is the identified address (which will generally has commas within it). In summary, that is:
The address will likely have embedded commas and so to extract just the address:
$ ml geocode google 12 smith street canberra -35.24:149.05,-35.25:149.05:-35.25:149.05,...,...,12 Smith St, Weetangera ACT 2614, Australia $ ml geocode google 12 smith street canberra | cut -d, -f5- 12 Smith St, Weetangera ACT 2614, Australia
If the location is ambiguous then several rows will be returned, one for each possible location.
You can control the maximum number of matches (1-20) with the default
being 5, through
Instead of providing the output described above you can request a URL
(universal resource locator) be returned. The URL is a link to a map
using either Open Street Map (preferred and default for
--osm``), Google Maps (-b
), or Google Maps (-g
The following example splits the single line of output across several lines here for presentation. We geocode a specific locality:
$ ml geocode google --max=1 anzac parade
This identifies it as:
-33.955379486083984:151.2429656982422, -34.12508010864258:151.07327270507812:-33.78567886352539:151.41265869140625, High,Ambiguous,PopulatedPlace, Anzac Parade, NSW, Australia
The URL generation defaults to producing a URL link to Open Street Maps:
$ ml geocode google --url anzac parade
There are actually three matches for this address.
You can copy and paste the URL into a browser. But suppose you want to display it directly into the browser:
$ brave-browser `ml geocode --url google anzac parade`
Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0