@@ -15,8 +15,7 @@ Basic requirements are the following:
15
15
* numpy
16
16
* [ pyproj] ( https://github.com/pyproj4/pyproj )
17
17
* [ 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.
20
19
* On Linux, if your Python was installed via a package management
21
20
system, make sure the corresponding ` python-dev ` package is also
22
21
installed. Otherwise, you may not have the Python header (` Python.h ` ),
@@ -28,53 +27,64 @@ Optional requirements include:
28
27
` BaseMap.wmsimage ` function.
29
28
30
29
* [ 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.
33
32
34
33
## Installation
35
34
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
+ ```
37
46
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:
41
48
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:
49
55
``` 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
56
58
```
57
59
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 ` .
62
69
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
+ ```
66
75
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.
71
81
72
82
## License
73
83
74
84
The source code and data assets are under the following licenses:
75
85
76
86
* ` 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.
78
88
* ` basemap-data ` : [ LGPL-3.0-or-later] .
79
89
* The EPSG file and the JPG images are also under the [ MIT] license.
80
90
* ` basemap-data-hires ` : [ LGPL-3.0-or-later] .
0 commit comments