@@ -15,8 +15,7 @@ Basic requirements are the following:
1515* numpy
1616* [ pyproj] ( https://github.com/pyproj4/pyproj )
1717* [ pyshp] ( https://github.com/GeospatialPython/pyshp )
18- * The GEOS (Geometry Engine - Open Source) library (version 3.1.1 or
19- higher). Source code is included in the ` geos-3.3.3 ` directory.
18+ * GEOS library (Geometry Engine, Open Source) version 3.1.1 or higher.
2019* On Linux, if your Python was installed via a package management
2120 system, make sure the corresponding ` python-dev ` package is also
2221 installed. Otherwise, you may not have the Python header (` Python.h ` ),
@@ -28,53 +27,64 @@ Optional requirements include:
2827 ` BaseMap.wmsimage ` function.
2928
3029* [ Pillow] ( https://python-pillow.github.io/ ) . It is needed for Basemap
31- warpimage, bluemarble, shadedrelief, and etop methods. PIL should work
32- on Python 2.x. Pillow is a maintained fork of PIL.
30+ warpimage, bluemarble, shadedrelief, and etopo methods. PIL should
31+ work on Python 2.x. Pillow is a maintained fork of PIL.
3332
3433## Installation
3534
36- 0 . Install pre-requisite Python modules numpy and matplotlib.
35+ The ` basemap-data ` and ` basemap-data-hires ` packages are available in
36+ PyPI and can be installed with [ ` pip ` ] ( https:/pip.pypa.io/ ) :
37+ ``` sh
38+ python -m pip install basemap-data
39+ python -m pip install basemap-data-hires
40+ ```
41+
42+ Precompiled binaries for GNU/Linux are also available in PyPI:
43+ ``` sh
44+ python -m pip install basemap
45+ ```
3746
38- 1 . Then download ` basemap-X.Y.Z.tar.gz ` (approx 100 MB) from the
39- [ GitHub Releases] ( https://github.com/matplotlib/basemap/releases ) page,
40- unpack and ` cd ` to ` basemap-X.Y.Z ` .
47+ Otherwise, you will need to install ` basemap ` from source as follows:
4148
42- 2 . Install the GEOS library. If you already have it on your system, just
43- set the environment variable ` GEOS_DIR ` to point to the location of
44- ` libgeos_c ` and ` geos_c.h ` (if ` libgeos_c ` is in ` /usr/local/lib ` and
45- ` geos_c.h ` is in ` /usr/local/include ` , set ` GEOS_DIR ` to
46- ` /usr/local ` ). Then go to step (3). If you don't have it, you can
47- build it from the source code included with basemap by following
48- these steps:
49+ 1 . Install pre-requisite Python modules:
50+ - ` cython ` .
51+ - ` numpy ` .
52+
53+ 2 . Download the ` basemap ` source code and move to the ` packages/basemap `
54+ folder:
4955 ``` sh
50- cd geos-3.3.3
51- export GEOS_DIR=< where you want the libs and headers to go>
52- # A reasonable choice on a Unix-like system is /usr/local, or
53- # if you don't have permission to write there, your home directory.
54- ./configure --prefix=$GEOS_DIR
55- make; make install
56+ git clone https://github.com/matplotlib/basemap.git
57+ cd basemap/packages/basemap
5658 ```
5759
58- 3 . ` cd ` back to the top level basemap directory (` basemap-X.Y.Z ` ) and
59- run the usual ` python setup.py install ` . Check your installation by
60- running `` "from mpl_toolkits.basemap import Basemap" `` at the Python
61- prompt.
60+ 3 . Build the GEOS library. You may use the helper provided in ` utils ` , i.e.
61+ ``` sh
62+ export GEOS_DIR=< your desired location>
63+ python -c " import utils; utils.GeosLibrary('3.6.5').build(installdir='${GEOS_DIR} ')"
64+ ```
65+ or you can link directly to the system library if it is already installed.
66+ ` GEOS_DIR ` must point to the GEOS installation prefix; e.g. if ` libgeos_c.so `
67+ is located in ` /usr/lib ` and ` geos_c.h ` is located in ` /usr/include ` , then
68+ you must set ` GEOS_DIR ` to ` /usr ` .
6269
63- 4 . To test, ` cd ` to the examples folder and run ` python simpletest.py ` .
64- To run all the examples (except those that have extra dependencies or
65- require an internet connection), execute ` python run_all.py ` .
70+ 4 . Build the basemap wheel from the ` packages/basemap ` folder and install it:
71+ ``` sh
72+ python setup.py bdist_wheel
73+ python -m pip install dist/* .whl
74+ ```
6675
67- An alternative method is using ` pip ` :
68- ```
69- python -m pip install --user git+https://github.com/matplotlib/basemap.git
70- ```
76+ 5 . Check that the package installed correctly by executing in the terminal:
77+ ``` sh
78+ python -c " from mpl_toolkits.basemap import Basemap"
79+ ```
80+ You can also test the ` basemap ` examples available in the ` examples ` folder.
7181
7282## License
7383
7484The source code and data assets are under the following licenses:
7585
7686* ` basemap ` : [ MIT] .
77- * GEOS source code and dynamic library are under the [ LGPL-2.1-only] license.
87+ * GEOS bundled dynamic library is under the [ LGPL-2.1-only] license.
7888* ` basemap-data ` : [ LGPL-3.0-or-later] .
7989 * The EPSG file and the JPG images are also under the [ MIT] license.
8090* ` basemap-data-hires ` : [ LGPL-3.0-or-later] .
0 commit comments