Skip to content

Commit

Permalink
v0.10.4
Browse files Browse the repository at this point in the history
- add the option to only set up the ESO cache
  • Loading branch information
JamieTaylor-TUOS committed Jul 21, 2022
1 parent 0667aaa commit b5725a1
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 20 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Geocode various geographical entities including postcodes and LLSOAs. Reverse-geocode to LLSOA or GSP.

*Latest Version: 0.10.3*
*Latest Version: 0.10.4*

## What is this repository for?

Expand Down Expand Up @@ -32,17 +32,18 @@ Check that the installation was successful by running the following command from
This will print the helper for the limited command line interface which provides tools to help get set up and to clear the cache when needed:

```
usage: geocode [-h] [--clear-cache] [--debug] [--setup]
[--load-cpo-zip </path/to/zip-file>] [--load-gmaps-key <gmaps-api-key>]
usage: geocode.py [-h] [--clear-cache] [--debug] [--setup] [--setup-eso]
[--load-cpo-zip </path/to/zip-file>] [--load-gmaps-key <gmaps-api-key>]
This is a command line interface (CLI) for the Geocode module version 0.8.10.
This is a command line interface (CLI) for the Geocode module version 0.10.4.
optional arguments:
-h, --help show this help message and exit
--clear-cache Specify to delete the cache files.
--debug Geocode some sample postcodes/addresses/LLSOAs.
--setup Force download all datasets to local cache (useful if running
inside a Docker container i.e. run this as part of image build).
--setup-eso Force download all ESO datasets to local cache.
--load-cpo-zip </path/to/zip-file>
Load the Code Point Open data from a local zip file.
--load-gmaps-key <gmaps-api-key>
Expand Down
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/doctrees/modules.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 9caff14630f84b074099921acac705b3
config: d4b600d4ad81b46259ac9874ab167859
tags: 645f666f9bcd5a90fca523b33c5a78b7
18 changes: 14 additions & 4 deletions docs/build/html/_modules/geocode.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>geocode &mdash; Geocode 0.10.3 documentation</title>
<title>geocode &mdash; Geocode 0.10.4 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand Down Expand Up @@ -76,7 +76,7 @@ <h1>Source code for geocode</h1><div class="highlight"><pre>
<span class="sd">- First Authored: 2019-10-08</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="n">__version__</span> <span class="o">=</span> <span class="s2">&quot;0.10.3&quot;</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s2">&quot;0.10.4&quot;</span>

<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">sys</span>
Expand Down Expand Up @@ -180,7 +180,7 @@ <h1>Source code for geocode</h1><div class="highlight"><pre>
<span class="bp">self</span><span class="o">.</span><span class="n">pc_llsoa_lookup_cache_file</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ons_dir</span><span class="p">,</span>
<span class="sa">f</span><span class="s2">&quot;pc_llsoa_lookup_</span><span class="si">{</span><span class="n">version_string</span><span class="si">}</span><span class="s2">.p&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">pc_llsoa_zipfile</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ons_dir</span><span class="p">,</span>
<span class="s2">&quot;PCD_OA_LSOA_MSOA_LAD_MAY22_UK_LU.csv&quot;</span><span class="p">)</span>
<span class="s2">&quot;PCD_OA_LSOA_MSOA_LAD_MAY22_UK_LU.zip&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">gov_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">SCRIPT_DIR</span><span class="p">,</span> <span class="s2">&quot;gov&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">constituency_lookup_file</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">gov_dir</span><span class="p">,</span>
<span class="s2">&quot;constituency_centroids_Dec2020.psv&quot;</span><span class="p">)</span>
Expand Down Expand Up @@ -270,14 +270,18 @@ <h1>Source code for geocode</h1><div class="highlight"><pre>

<div class="viewcode-block" id="Geocoder.force_setup"><a class="viewcode-back" href="../modules.html#geocode.Geocoder.force_setup">[docs]</a> <span class="k">def</span> <span class="nf">force_setup</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Download all data and setup caches.&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_load_gsp_boundaries_20220314</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_load_code_point_open</span><span class="p">(</span><span class="n">force_reload</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_load_llsoa_lookup</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_load_llsoa_boundaries</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_load_datazone_lookup</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_load_postcode_llsoa_lookup</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_load_constituency_lookup</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_load_lad_lookup</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">force_setup_eso</span><span class="p">()</span></div>

<div class="viewcode-block" id="Geocoder.force_setup_eso"><a class="viewcode-back" href="../modules.html#geocode.Geocoder.force_setup_eso">[docs]</a> <span class="k">def</span> <span class="nf">force_setup_eso</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Download all ESO data and setup caches.&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_load_gsp_boundaries_20220314</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_load_dno_boundaries</span><span class="p">()</span></div>

<span class="k">def</span> <span class="nf">_load_gmaps_key</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
Expand Down Expand Up @@ -1369,6 +1373,8 @@ <h1>Source code for geocode</h1><div class="highlight"><pre>
<span class="n">required</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">help</span><span class="o">=</span><span class="s2">&quot;Force download all datasets to local cache (useful &quot;</span>
<span class="s2">&quot;if running inside a Docker container i.e. run this &quot;</span>
<span class="s2">&quot;as part of image build).&quot;</span><span class="p">)</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--setup-eso&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;setup_eso&quot;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;store_true&quot;</span><span class="p">,</span>
<span class="n">required</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">help</span><span class="o">=</span><span class="s2">&quot;Force download all ESO datasets to local cache.&quot;</span><span class="p">)</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--load-cpo-zip&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;cpo_zip&quot;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;store&quot;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">str</span><span class="p">,</span>
<span class="n">required</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">&quot;&lt;/path/to/zip-file&gt;&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Load the Code Point Open data from a local zip file.&quot;</span><span class="p">)</span>
Expand Down Expand Up @@ -1479,6 +1485,10 @@ <h1>Source code for geocode</h1><div class="highlight"><pre>
<span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Running forced setup&quot;</span><span class="p">)</span>
<span class="k">with</span> <span class="n">Geocoder</span><span class="p">()</span> <span class="k">as</span> <span class="n">geocoder</span><span class="p">:</span>
<span class="n">geocoder</span><span class="o">.</span><span class="n">force_setup</span><span class="p">()</span>
<span class="k">if</span> <span class="n">options</span><span class="o">.</span><span class="n">setup_eso</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Running forced setup of ESO data&quot;</span><span class="p">)</span>
<span class="k">with</span> <span class="n">Geocoder</span><span class="p">()</span> <span class="k">as</span> <span class="n">geocoder</span><span class="p">:</span>
<span class="n">geocoder</span><span class="o">.</span><span class="n">force_setup_eso</span><span class="p">()</span>
<span class="k">if</span> <span class="n">options</span><span class="o">.</span><span class="n">debug</span><span class="p">:</span>
<span class="n">debug</span><span class="p">()</span>

Expand Down
2 changes: 1 addition & 1 deletion docs/build/html/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Overview: module code &mdash; Geocode 0.10.3 documentation</title>
<title>Overview: module code &mdash; Geocode 0.10.4 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/html/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '0.10.3',
VERSION: '0.10.4',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
6 changes: 5 additions & 1 deletion docs/build/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &mdash; Geocode 0.10.3 documentation</title>
<title>Index &mdash; Geocode 0.10.4 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand Down Expand Up @@ -93,6 +93,10 @@ <h2 id="F">F</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules.html#geocode.Geocoder.force_setup">force_setup() (geocode.Geocoder method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules.html#geocode.Geocoder.force_setup_eso">force_setup_eso() (geocode.Geocoder method)</a>
</li>
</ul></td>
</tr></table>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Welcome to Geocode’s documentation! &mdash; Geocode 0.10.3 documentation</title>
<title>Welcome to Geocode’s documentation! &mdash; Geocode 0.10.4 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand Down
8 changes: 7 additions & 1 deletion docs/build/html/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Modules &mdash; Geocode 0.10.3 documentation</title>
<title>Modules &mdash; Geocode 0.10.4 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand Down Expand Up @@ -152,6 +152,12 @@ <h2><a class="toc-backref" href="#id2">geocode</a><a class="headerlink" href="#g
<dd><p>Download all data and setup caches.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="geocode.Geocoder.force_setup_eso">
<span class="sig-name descname"><span class="pre">force_setup_eso</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/geocode.html#Geocoder.force_setup_eso"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#geocode.Geocoder.force_setup_eso" title="Permalink to this definition"></a></dt>
<dd><p>Download all ESO data and setup caches.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="geocode.Geocoder.geocode">
<span class="sig-name descname"><span class="pre">geocode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">postcodes</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Iterable</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">addresses</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Iterable</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">Tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">float</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">float</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="_modules/geocode.html#Geocoder.geocode"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#geocode.Geocoder.geocode" title="Permalink to this definition"></a></dt>
Expand Down
Binary file modified docs/build/html/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/html/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Search &mdash; Geocode 0.10.3 documentation</title>
<title>Search &mdash; Geocode 0.10.4 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />

Expand Down
Loading

0 comments on commit b5725a1

Please sign in to comment.