The sample code for this article has been uploaded to my
Github
Warehouse https://github.com/CNFeffery/DataScienceStudyNotes
Hello, everyone. I'm Mr. Fei , Just a few days ago ,geopandas
Published its 0.11.0
Official version , From its previous version (0.10.2
) Half a year has passed since the release , What important new features have been brought to us in this new version update , In today's article, I will take you to find out .
You can geopandas
Upgrade based on , You can also create a new virtual environment and install it directly 0.11.0
edition , In line with the principle of cautious taste , We can use the following command to create a new virtual environment at one go 、geopandas
And related dependent installations , And install jupyterlab
As IDE demonstrate :
conda create -n geopandas-env python=3.8 -c https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main -y
conda activate geopandas-env
conda install geopandas=0.11.0 pygeos pyogrio -c conda-forge -y
pip install jupyterlab -i https://pypi.douban.com/simple/
Execute the following commands in the terminal to verify whether it is correctly installed :
python -c "import geopandas as gpd;print(gpd.__version__)"
Everything is all set. , Let's take a look at some of the more important features in this update :
In the new version read_file()
And to_file()
Parameters are introduced engine
Used to specify the engine on which to read and write common vector files , The default is the original 'fiona'
, Optional 'pyogrio'
, This is from geopandas
Another library maintained by the development team , It can greatly improve the understanding of common vector file formats, such as shapefile
Reading and writing speed , Take the reading of the whole building contour data in Guangzhou with millions of polygons as an example , new IO The engine brings near 5 Times the read performance :
And equally close 5 Times the write performance :
0.11
New in for GeoSeries
and GeoDataFrame
Methods clip_by_rect(minx, miny, maxx, maxy)
, The target rectangular coordinate range can be passed in , Quickly cut out the vector within the rectangle , For example, we are based on the previously read building outline data of Guangzhou , Randomly generate the side length by the following function 10000 The rectangular range of meters is used as cutting material :
import numpy as np
import matplotlib.pyplot as plt
from shapely.geometry import box
# Calculate the target GeoDataFrame Range
minx, miny, maxx, maxy = gdf.total_bounds
def generate_random_rectangle(minx, miny, maxx, maxy):
'''
Randomly obtained within the scope of the study 100000 M side length rectangle
'''
random_rectangle = [
np.random.uniform(minx, maxx - 10000),
np.random.uniform(miny, maxy - 10000)
]
return [
*random_rectangle,
random_rectangle[0] + 10000,
random_rectangle[1] + 10000,
]
call clip_by_rect()
:
The returned result is consistent with the number of original vector records , Where presented GEOMETRYCOLLECTION EMPTY
The record of indicates that it does not intersect with the target rectangle , We make use of is_empty
To reverse filter out the vector records that have been trimmed :
besides , You can also direct [minx, miny, maxx, maxy]
The input format is passed into the classic clip()
Cutting method , It will call directly at the bottom clip_by_rect()
And automatically return the effective vector cutting result :
from 0.11.0
Version start ,geopandas
When facing a date time field , Whether it is written to GIS File or from GIS File read in , Can be correctly resolved to date time type :
You can https://github.com/geopandas/geopandas/releases/tag/v0.11.0
See the full version update instructions , Overall speaking , There are not many important updates brought about by this new version update , But they are quite practical , You can use it on your own data .
The above is the whole content of this paper , Welcome to discuss with me in the comments section ~
This article sample code and files have been uploaded to my Github Warehouse https://github.com/CNFeffery/DataScienceStudyNotes 1 brief introduction Not so long ago , We are very familiar with Python Geography ...
The corresponding code of this article has been uploaded to my Github Warehouse https://github.com/CNFeffery/DataScienceStudyNotes 1 brief introduction In the last article, we discussed geopandas Data nodes in ...
One . brief introduction In the last article ( Data science learning notes 41) We have learned about folium Basic content of , actually folium The real excellence in geographic information visualization lies in the high degree of customization of the drawn images , This article will be based on folium Some of the official documents ...
* From the beginning of this article, the data and code of all articles have been uploaded to my github Warehouse :https://github.com/CNFeffery/DataScienceStudyNotes One . brief introduction pandas There are a lot of ways ...
1 brief introduction In the data analysis task , Read in from raw data , By the end of the analysis , Most of the time in the middle is to process and regularize the data step by step , By assembly line (pipeline) This process is more conducive to carding the context of analysis , It is also more conducive to error checking and correction ...
One . brief introduction R Medium ggplot2 It's a very powerful and flexible data visualization package , Familiar with its drawing rules, you can freely generate various visual images , But its default color and style are unavoidably too simple in many cases , This article will introduce the ggthemr The package is specifically for the original ...
One . brief introduction And then a few months ago ( Data science learning notes 31) be based on Python Network data collection ( Elementary chapter ), In that article , We introduced the basics of web crawlers ( Basic request Library , Basic parsing library ,CSS, Regular expressions, etc ), In that article ...
One . brief introduction Scala Pattern matching in is similar to Java Medium switch sentence , And more robust , This article will focus on Scala Some basic examples of pattern matching are introduced : Two .Scala Pattern matching in 2.1 The basic format Scala Medium mode match ...
One . brief introduction I'm in my senior year , Recently in the summer internship , Outside the main business of data mining , Also help colleagues do a lot of network data collection content , The next few articles will be listed one by one , To continue to write a few months ago to open this network data collection practical pit . Two . Ma beehive reviews data collection ...
One . brief introduction Keras It has an autonomous set of front-end control Syntax , Backend based tensorflow and theano Deep learning framework , Because of its simple, fast and clear grammar style of building neural network , It can help users build their own neural network more quickly , It can be called depth ...
Official website vue.js It's like this : A set of tools for building user interfaces Progressive framework . Unlike other heavyweight frameworks ,Vue Adopt the design of bottom-up incremental development . So what exactly is a progressive framework . What is bottom-up incremental development ? Actually, I think this ...
1. download wget http://download.redis.io/releases/redis-2.8.13.tar.gz 2. decompression tar zxvf redis-2.8.13.tar.gz 3. ...
1. Define regular expressions : a. The ordinary way :var reg=/ expression / Additional parameters Attachment parameters : g: Represents that global matching can be performed .i: Represents a case insensitive match .m: Represents that multiple lines can be matched . The above three parameters , Any combination of , Stands for compound ...
Set up... On the desktop or somewhere else mongodb.bat Batch file Write the following in it mongod --dbpath D:\java_tools\MongoDB\MongoDBDATA preservation - Then open the file ...
describe Description applepi There's only one door to the place of confinement , Local Call it “ The door of the dark mage ”. There's an undirected picture on this door , And the code to open this door is in the picture [ The degree of each point is greater than zero and is even ] The number pairs of subgraphs of ...
One .RabbitMQ python Of Queue And RabbitMQ Understanding between : python Process or thread of Queue Can only python Self use .RabbitMQ Queue multiple applications share queues , Communicate with each other . 1. ordinary ...
After the kernel starts and initializes , The ultimate goal is like Windows It can also start the application , stay windows Every application in the C disc .D Plate, etc. , and linux Each application in is stored in the root file system , So where is the root file system mounted , How to achieve ...
Docker So that everyone can learn from Docker Registry Start a packaged Docker application .Docker-Compose stay Docker On this basis, the dependency startup problem between multi container applications is solved . Docker ...
During the test , Sometimes you need to delete some files , For example, the log file is too large , Here is a summary of some common methods for deleting files Take the files in this system as an example Delete file ( That is, the file is deleted ) Single delete :rm -f + file name eg:rm -f 2 ...
This article will start from Redis Start with the basic characteristics of , By telling Redis Data structure and main command pairs of Redis The basic ability of . And then the Overview Redis Advanced capabilities offered , And deploy . maintain . Performance tuning and other aspects of more in-depth introduction and guidance . ...