Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the necessary tool for mapping the epidemic situation in python

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail what are the necessary tools for mapping the epidemic in python. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Basemap is a toolkit under the Python visualization library Matplotlib. Its main function is to draw two-dimensional maps, which is very important for the visualization of spatial data.

Although many commonly used packages of Python are now included in Anaconda, even if not, you can use the PIP command to install directly and quickly, but Basemap is an exception. It is neither in Anaconda nor can be installed directly with PIP, so you can only install Basemap manually.

Installation of Basemap in Linux Environment

First download the software package for basemap.

I directly right-click here to copy the address of the source code tar package, ready to use the wget command to download directly, of course, you can also click the link to download the corresponding package and upload it to Linux.

1) download the installation package and extract it

Wget https://github.com/matplotlib/basemap/archive/v1.1.0.tar.gz

Tar\-zxvf v1.1.0.tar.gz

2) install dependent libraries

Cd basemap\-1.1.0 /

Pip install\-r requirements.txt

The contents of the dependent environment description file requirements.txt are pyproj > = 1.9.3 and pyshp > = 1.2.0, because we are using Anaconda's Python, so we only need these two dependent libraries. If we are installing Basemap with the system's own Python, we also need to install matplotlib and numpy, two basic libraries.

3) compile and install GEOS library

Cd geos\-3.3.3

Export GEOS\ _ DIR\ = / usr/local

. / configure\-- prefix\ = $GEOS\ _ DIR

Make; make install

GEOS is an open source computing library to deal with the spatial relationship of geometry, which is almost the underlying dependence of most geographic information and spatial analysis related libraries. The source package of the GEOS library is already included in the basemap installation package and does not need to be downloaded separately.

To install the GEOS library, you need to compile and install it, enter the GEOS source directory, and then use the export command to set an environment variable to declare the installation path of the GEOS library. Here we use the installation directory / usr/local, of course, you can also specify other locations. Then compile and install-- prefix is used to specify the installation path of the GEOS library.

4) install basemap

Cd..

Python setup.py install

Return to the basemap-1.1.0 directory and use the setup.py file for installation.

5) Test

Cd examples/

Python simpletest.py

Basemap installation package provides a lot of sample code, here we try to run the simpletest.py code file, if the terminal can output the following figure, it is proved that the installation is successful.

This is the end of the article on "what are the necessary tools for mapping the epidemic in python". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report