diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-11-02 21:35:09 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-11-02 21:35:09 +0100 |
| commit | 1a5effec286e4753dfdd8e8279abbbdf1ce8e0d2 (patch) | |
| tree | 1136e5231a758b8503785a2be66b558510ea2ea6 /s2-index.py | |
| parent | ec63582b349eaa23a9e22fc160ab3a3d621c4f47 (diff) | |
s2 scripts
Diffstat (limited to 's2-index.py')
| -rw-r--r-- | s2-index.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/s2-index.py b/s2-index.py new file mode 100644 index 00000000..779f63a5 --- /dev/null +++ b/s2-index.py @@ -0,0 +1,24 @@ +import click +import ijson.backends.yajl2_cffi as ijson + +@click.command() +@click.option('--index', '-n', default=0, help='Index of CSV.') +def build_index(): + pass + +def index_file(fn): + with open(fn, 'r') as f: + parser = ijson.parse(urlopen('http://.../')) + stream.write('<geo>') + for prefix, event, value in parser: + if (prefix, event) == ('earth', 'map_key'): + stream.write('<%s>' % value) + continent = value + elif prefix.endswith('.name'): + stream.write('<object name="%s"/>' % value) + elif (prefix, event) == ('earth.%s' % continent, 'end_map'): + stream.write('</%s>' % continent) + stream.write('</geo>') + +if __name__ == '__main__': + build_index() |
