I wanted to create some map visualizations using python, and found Basemap is a library that many people recommend. However, I got into some troubles installing Basemap on mac. My favourite “pip install” strategy just didn’t work for this Basemap library.
The installation of Basemap requires some pre-requisites, while these pre-requisites require some other pre-requisites. And for some unknown reasons, the instruction I found on-line doesn’t work on my mac. So here is my step-by-step instructions to install Basemap library on mac. Hope it could help people having the some problem as I did.
![Basemap python documentation Basemap python documentation](/uploads/1/2/6/7/126753944/905341245.png)
To install Basemap, you need to have geos and proj.4 library installed on your system. And the easiest way I found to install these two library is to use MacPorts. To have MacPorts ready on your mac, you need to first install Xcode and command line tools for Xcode.
- Feature Basic Pro; Nationwide parcel boundaries Nationwide parcel boundaries with landowner names Nationwide color coded government lands Hybrid 3D maps.
- Version 1.0.6 (git tag v1.0.6rel) -. fix drawcounties for Python 3.3. update pyproj to version 1.9.3 (remove geographiclib python code, replace with C code from proj4). in contourf and contour, all points outside the map projection region were masked.
- We focus on Python here, but for a broad overview of Mac coding and the various languages you can choose from, read our complete guide to coding and programming on a Mac. The benefits of Python.
- From @fonnesbeck on September 12, 2017 1:5 Creating a conda env with basemap named as one of the packages installs cleanly, but results in the following when basemap is imported: ModuleNotFoundErro.
It makes it easy to scout campsites, sources of water, potential hazards and more. If you prefer raster topographic maps, you can also download BirdsEye Select maps and pay only for the data you download. Learn More About BaseCamp. For manuals, videos and other helpful information visit the Support Center.
Then you can download MacPorts and install it on your computer.
With MacPort installed, you can then install geos and proj.4 libraries by using the following codes:
sudo port install geos
sudo port install proj
sudo port install geos
sudo port install proj
Python Install Basemap
Next, you need to download basemap package, unzip the package, and navigate to the directory:
cd basemap-1.x.x
then run the following code:
sudo python setup.py install
cd basemap-1.x.x
then run the following code:
sudo python setup.py install
Now, you are all set. Try simpletest.py in the examples folder under your basemap folder, you should be able to see a colored map (it takes a minute or so though).
Basemap Python 3
It doesn’t look complicated at all at this point, but it was really a pain when you follow official or someone else’s instructions but always get errors. I didn’t figure out why I got errors when following instructions (they must work for others), but I am glad that I eventually find a detour to walk around.
Basemap Python Source Code
I guess that’s what happened in life. You don’t always find a way out following someone else’s steps, but it doesn’t mean you cannot find out your own way.