Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'add_cities' to use modern GeoNames data #61

Merged
merged 31 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6d3f4f5
Fixed add_cities, plot grid before cities
lobsiger Apr 20, 2022
70fc4fc
Ooops, must still commit this stuff ...
lobsiger Apr 20, 2022
f8fa535
Added tests for cities
lobsiger Apr 20, 2022
91108ef
Fixed mainly flake8 stuff ...
lobsiger Apr 20, 2022
d3c6372
Fixed 2 typos in comment lines
lobsiger Apr 21, 2022
97ea309
Dave made symbol 'asterisk' work under agg by deleting 16 paranthesis.
lobsiger Apr 24, 2022
0c9a236
Added more symbols for 'cities' and 'points'.
lobsiger Apr 24, 2022
5bb8657
Tried to factorize kind of ...
lobsiger Apr 24, 2022
8b1a0a5
Replaced deprecated function twice.
lobsiger Apr 25, 2022
4ebac6d
Tried to make Windows understand utf-8
lobsiger Apr 25, 2022
17a277a
Added the param_key logic of PR #56, synchronized defaults.
lobsiger Apr 26, 2022
d9e388d
Made overlays['cities'] a list as proposed by Dave.
lobsiger Apr 27, 2022
fa5f78e
Fixed typo in comment.
lobsiger Apr 28, 2022
cfca9c9
Upstream changes merged
lobsiger May 4, 2022
0f1411b
Flake8 as usual + 4 x self.
lobsiger May 4, 2022
fc03efd
Made better tests for cities_from_dict
lobsiger May 5, 2022
0e89ee6
Synchronized with upstream, reduced cities5000.txt
lobsiger May 6, 2022
172da43
Merged 'main' into 'fix_cities'
lobsiger May 7, 2022
103b9e5
Added final (?) city files, synchronized fill of 'points' and 'cities…
lobsiger May 7, 2022
6b467c9
Backward compatibility and 'cities'/'shapefiles' from config
lobsiger May 9, 2022
782473c
Made requested changes, added 2 tests, minimized cities.txt
lobsiger May 9, 2022
4bb6367
Changed suffix from .txt to .red. City files should not open in brows…
lobsiger May 10, 2022
078342c
Documented installation procedure
lobsiger May 10, 2022
0128f5c
Cities file had wrong name :-(
lobsiger May 10, 2022
f461da8
Of course you cannot just rename a file inder git control :-\
lobsiger May 10, 2022
6bcc142
Made requested changes
lobsiger May 10, 2022
1c38d1d
Two missing files added
lobsiger May 10, 2022
7669ea8
Fix config-based test being directory dependent
djhoese May 11, 2022
e1e7309
Rewrite installation instructions and remove cities zip file
djhoese May 11, 2022
2400e76
Revert to GeoNames cities file scheme
djhoese May 11, 2022
5bc1e8f
Refactor add_cities a little
djhoese May 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ images using data from the GSHHS and WDBII datasets
.. toctree::
:maxdepth: 2

installation
installation_shape_files
installation_city_names
usage
high_quality_contours
graticule
Expand Down
35 changes: 35 additions & 0 deletions docs/source/installation_city_names.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Installation of city names
--------------------------

Add a subdirectory CITIES to your *DB_DATA_ROOT*.
Download cities2022.zip_ from github/pytroll/pycoast.
If this deep link does no work (anymore) you can try
do download it from github.com/pytroll/pycoast/ from
directory tests/test_data/ by pressing the *Download*
button. If all fails ask for help on the google
pytroll_ list or on MSG-1_. Put cities2022.zip into
CITIES. The structure of *DB_DATA_ROOT* should now be::

.
├── GSHHS_shp
│ ├── c
│ ├── f
│ ├── h
│ ├── i
│ └── l
├── WDBII_shp
│ ├── c
│ ├── f
│ ├── h
│ ├── i
│ └── l
└── CITIES

Where CITIES contains cities2022.zip. Enter this archive
and read file README_PyCoast.txt inside. Follow its instructions.
You will end up with an additional tab delimited text file *cities.red* in CITIES.
The PyCoast API documentation explains in detail how to call the function *add_cities()*.

.. _cities2022.zip: https://raw.githubusercontent.com/lobsiger/pycoast/fix_cities/pycoast/tests/test_data/gshhs/CITIES/cities2022.zip
.. _pytroll: https://groups.google.com/g/pytroll/
.. _MSG-1: https://groups.io/g/MSG-1/
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
Installation
------------
Installation of shape files
---------------------------
Pycoast depends on pyshp_ and PIL_.

Install pycoast and dependencies.

Download the zipped GSHHS and WDBII Shapefiles from SOEST_.
Unzip the files to a data directory (hereafter called *GSHHS_DATA_ROOT*).
The structure of *GSHHS_DATA_ROOT* should now be::
Unzip the files to a data directory (hereafter *DB_DATA_ROOT*).
The absolute path/name of this directory is called *db_root_path*
in the code examples further down.
The structure of *DB_DATA_ROOT* should now be::

.
├── GSHHS_shp
Expand All @@ -22,8 +24,9 @@ The structure of *GSHHS_DATA_ROOT* should now be::
├── i
└── l

Where each dir on the lowest level contains Shapefiles like *GSHHS_shp/c/GSHHS_c_L1.shp*
Where each dir on the lowest level contains Shapefiles like
*GSHHS_shp/c/GSHHS_c_L1.shp, WDBII_shp/WDBII_border_c_L1.shp*

.. _SOEST: http://www.soest.hawaii.edu/pwessel/gshhs/index.html
.. _PIL: http://www.pythonware.com/products/pil/
.. _PIL: https://pillow.readthedocs.io/en/stable/
.. _pyshp: http://code.google.com/p/pyshp/
8 changes: 4 additions & 4 deletions pycoast/cw_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,25 +124,25 @@ def _draw_asterisk(self, draw, pt_size, coordinate, **kwargs):
# draw '|'
(x_bm, y_bm) = (x, y - half_ptsize) # bottom middle point
(x_tm, y_tm) = (x, y + half_ptsize) # top middle point
self._draw_line(draw, [(x_bm, y_bm), (x_tm, y_tm)],
self._draw_line(draw, [x_bm, y_bm, x_tm, y_tm],
outline=outline, width=width,
outline_opacity=outline_opacity)
# draw '-'
(x_lm, y_lm) = (x - half_ptsize, y) # left middle point
(x_rm, y_rm) = (x + half_ptsize, y) # right middle point
self._draw_line(draw, [(x_lm, y_lm), (x_rm, y_rm)],
self._draw_line(draw, [x_lm, y_lm, x_rm, y_rm],
outline=outline, width=width,
outline_opacity=outline_opacity)
# draw '/'
(x_bl, y_bl) = (x - half_ptsize, y - half_ptsize) # bottom left point
(x_tr, y_tr) = (x + half_ptsize, y + half_ptsize) # top right point
self._draw_line(draw, [(x_bl, y_bl), (x_tr, y_tr)],
self._draw_line(draw, [x_bl, y_bl, x_tr, y_tr],
outline=outline, width=width,
outline_opacity=outline_opacity)
# draw '\'
(x_tl, y_tl) = (x - half_ptsize, y + half_ptsize) # top left point
(x_br, y_br) = (x + half_ptsize, y - half_ptsize) # bottom right point
self._draw_line(draw, [(x_tl, y_tl), (x_br, y_br)],
self._draw_line(draw, [x_tl, y_tl, x_br, y_br],
outline=outline, width=width,
outline_opacity=outline_opacity)

Expand Down
Loading