Skip to content
This repository has been archived by the owner on Jun 14, 2021. It is now read-only.

Command line examples

Alex edited this page Apr 10, 2013 · 8 revisions

Installation of the package will also deploy a standalone script named GeoBase:

$ GeoBase ORY CDG              # query on the keys ORY and CDG
$ GeoBase --closest CDG        # closest from CDG
$ GeoBase --near LIG           # near LIG
$ GeoBase --fuzzy marseille    # fuzzy search on 'marseille'
$ GeoBase --admin              # to administrate the data sources
$ GeoBase --help               # your best friend

In the previous picture, you have an overview of the command line verbose display. Three displays are available for the command line tool:

  • the verbose display
  • the csv display with --quiet
  • the map display with --map
  • the graph display with --graph

With the verbose display, entries are displayed on each column, and the available fields on each line. Fields starting with __ like __field__ are special. This means they were added during data loading:

  • __key__ is the field containing the id of the entry. Ids are defined with a list of fields in the configuration file.
  • __dup__ is the field containing a list of duplicated keys. Indeed there is mechanism handling duplicated keys by default, which creates new keys if the key already exists in the GeoBase.
  • __par__ is the field containing the parent key if the key is duplicated.
  • __lno__ is the field containing the line number during loading.
  • __gar__ is the field containing the data which was not loaded on the line (this can be because the line was not well formatted, or because there were missing headers).

More examples here, for example how to do a search on a field, like admin_code (B8 is french riviera):

$ GeoBase -E adm1_code -e B8

Same with csv output (customized with --show):

$ GeoBase -E adm1_code -e B8 --quiet --show __ref__ iata_code  name

Add a fuzzy search:

$ GeoBase -E adm1_code -e B8 --fuzzy sur mer

All heliports under 200 km from Paris:

$ GeoBase --near PAR -N 200 -E location_type@raw -e 'H'

50 train stations closest to a specific geocode:

$ GeoBase -E location_type@raw -e R --closest '48.853, 2.348' -C 50

Countries with non-empty postal code regex:

$ GeoBase -b countries -E postal_code_regex -e '' --reverse --quiet

Multiple search on continent and currency_name:

$ GeoBase -b countries -E continent/currency_name -e AF/Euro 

Reading data input on stdin:

$ echo -e 'ORY^Orly\nCDG^Charles' | GeoBase

Display on map:

$ GeoBase -b stations --map

Marker-less map for a specific GMT offset:

$ GeoBase -E gmt_offset -e 1.0 --map -M _ _ country_code  __none__

Display your data on a map:

$ cat coords.csv
p1,48.22,2.33
p2,49.33,2.24
$ cat coords.csv | GeoBase --map

Display your data on a graph:

$ cat edges.csv
A,B
A,C
D,A
$ cat edges.csv | GeoBase --graph

If you want to learn more about the possibilities, use the learning mode:

$ GeoBase --ask
Clone this wiki locally