17.4 bing geocode

$ ml geocode bing <address>

The geocode command will geocode a supplied address and print, separated by commas, 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, and then the remaining is the determined address (which generally has commas within it).


See the web service documentation for details.

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. Also, instead of providing the output described above you can request a URL be returned that is a link to a map using either Open Street Map (preferred), Bing Maps, or Google Maps.

$ ml geocode bing [options] <address>
     -b            --bing               Generate Bing 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.

In illustrating the output here the single line of output is split across several lines.

Here we geocode a specific locality:

$ ml geocode bing --max=1 anzac parade
Anzac Parade, NSW, Australia

The URL generation defaults to Open Street Maps.

$ ml geocode bing --url anzac parade

There are actually three matches for this address.


Suppose we want to display the second match in the browser:

$ brave-browser `ml geocode --url bing anzac parade | sed '2q;d'`

The sed command (the stream editor) operates on the second line sent through the pipeline, printing it but deleting the other lines, and quits. Change 2 to 3, for example, to get the third match.


$ ml geocode bing bunnings mentone 23-27 nepean hwy mentone vic 3194
$ ml geocode bing back creek --max=3
$ ml geocode bing back creek --neighbourhood
$ ml geocode bing back creek --url

$ brave-browser `ml geocode bing --max=1 --url albany creek`

$ brave-browser `ml geocode bing bunnings mentone 23-27 nepean hwy mentone vic 3194 --url`

Your donation will support ongoing development 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-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.