This repository has been archived by the owner on Jun 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Admin mode tutorial
alexprengere edited this page Mar 13, 2013
·
9 revisions
The admin mode should be used to make your data source accessible as any other data source embedded in GeoBases.
Here is a concrete example. Suppose you have one file containing some point definitions, like this:
$ cat data.csv
#id,lat,lng
p0,39.1,2.5
p1,41.1,2.6
p2,42.1,2.7
p3,43.1,2.8
You can already use this to see that GeoBase correctly sniffs latitude and longitude (add --map
to display on a map):
$ cat data.csv | GeoBase --show lat lng --quiet
#lat^lng
42.1^2.7
43.1^2.8
39.1^2.5
41.1^2.6
We want to do make data.csv
a permanent data source of GeoBase. Easy, we are going to name the source mine!
$ GeoBase --admin
[ 0 ] Command: add
[ 1 ] Source name: mine
[2/8] Path: ./data.csv
[ ] Is the path local to the sources directory [yN]? N
[ ] Use data.csv as primary source from /home/alex/.GeoBases.d [yN]? Y
>>>>> first line >>>>>
#id,lat,lng
<<<<<<<<<<<<<<<<<<<<<<
[ ] Add another path [yN]? N
[3/8] Delimiter: ,
[4/8] Headers: id/lat/lng
[5/8] Key field(s): id
[ ] Add new index [yN]?
[ ] Add new join [yN]?
--- [before]
mine: {}
+++ [after]
mine:
delimiter: ','
headers:
- id
- lat
- lng
indices: []
join: []
key_fields: name
paths:
- file: /home/alex/.GeoBases.d/mine/data.csv
local: false
[8/8] Confirm [Yn]?
===== Changes saved to /home/alex/.GeoBases.d/Sources.yaml
Some remarks about what just happened:
- first, if you do this for real, you will get much more explanations along the way, I just did not want this page to be too long :)
- most of the answers are pre-filled, just correct them if needed (in this case we put id as the first column name)
- the question: Is the path local to the sources directory [yN]? means: are you giving me a relative path from the installation directory? When you add a new source, the answer will usually be No, but when you want to edit existing sources, who are located in the installation directory, the answer will Yes (and should be the default).
- the question: Use data.csv as primary source from /home/alex/.GeoBases.d [yN]? means: do you want me copy your file in a protected are were you will probably not accidentally erase it? This is very useful if your file is not too big, and you do not want to keep it in you current directory.
- notice at the end the changes that will be really added to the configuration file
Now you can to simply do:
$ GeoBase --base mine
This is very useful if you want to use a file as reference data for join clauses for example.