当前位置:网站首页>Geometric objects in shapely
Geometric objects in shapely
2022-06-30 03:43:00 【stone_ tigerLI】
Geometric object type
Preface
Main reference shapely Official documents .
Recently, some vector data needs to be processed in the project , Under the trend of curiosity , Want to know how these vector data are stored , And then I looked up some information , Make a brief summary of the information found so far .
Shapely The geometry involved in is mainly 2D, Although there is one z Coordinates but in actual geometric analysis , Hardly use , Negligible . And the constructed geometric objects will convert the value to float
type
There are four types of geometric objects : spot (Point)、 Line (LineString)、 closed loop (LinearRing)、 Noodles (Polygon)
spot (Point)
There is basically nothing to pay special attention to
# Construction point
from shapely.geometry import Point
point = Point(1,1)
# area , length , Frame
point.area
point.length
point.bounds
point.corrds # coordinate
point.corrds[:] # Coordinate slice
Point(point) # Directly copy other point information to build points
Line (LineString) and closed loop (LinearRing)
The two should be distinguished , Examples of differences between the two are as follows
from shapely.geometry import LineString
line = LineString([(0,0), (1,1), (2,0), (2,2), (0,2)])
line

from shapely.geometry.polygon import LinearRing
ring = LinearRing([(0,0), (1,1), (2,0), (2,2), (0,2)])
ring

Example 2
ring2 = LinearRing([(0,0), (1,1), (2,0), (2,2), (1,1),(0,2)])
ring2
line2 = LineString([(0,0), (1,1), (2,0), (2,2), (1,1),(0,2)])
line2


But both have length and no area .
ring.area
Out[13]: 0.0
ring.length
Out[14]: 8.82842712474619
line.area
Out[15]: 0.0
line.length
Out[16]: 6.82842712474619
Other attribute references Point
Noodles (Polygon)
Noodles , Also called polygon , The official definition of :class Polygon(shell[, holes=None])
Notice the difference between the brackets , The face accepts two parameters :
One is Orderly (x,y[,z])
Dot tuple , Simply put, there is a LinearRing
, This is in gdal It's similar inside , That is to say, the structural surface is formed after the closing operation with a line loop .
The other is Optional unordered Of Circular sequence , It is used to represent the internal boundary or “ hole ”.
LinearRing And Polygon What's the difference ?
LinearRing
边栏推荐
- [qt] qmap usage details
- [punch in - Blue Bridge Cup] day 4--------- split ('') cannot be used. There is a space after the last number of test cases. Split ()
- From 2500 a month, no one wants to go to the programming road of the technical director of a large factory | my ten years
- Openssl3.0 learning 22 provider decoder
- Half a year after joining the company, I was promoted to a management post
- [punch in - Blue Bridge Cup] day 1 --% 7F format output
- Use of foreach in QT
- Hash design and memory saving data structure design in redis
- Using virtual environments in jupyter notebook
- Redis在windows系统中使用
猜你喜欢
Number of students from junior college to Senior College (4)
1148_ Makefile learning_ Targets, variables, and wildcards in makefile
MySQL performance optimization (6): read write separation
Arrangement of language resources of upgraded version
王爽-汇编语言 万字学习总结
专升本高数(四)
[Note] ab Test and Variance Analysis
Use common fileUpload to upload files
Stc89c52/90c516rd/89c516rd DHT11 temperature and humidity sensor drive code
Realization of BFS in C language by storing adjacency matrix of graph
随机推荐
Using virtual environments in jupyter notebook
Hisense A7 ink screen mobile phone cannot be started
What does the hyphen mean for a block in Twig like in {% block body -%}?
Some common functions and precautions
[qt] qmap usage details
Redis在windows系统中使用
laravel9本地安装
LitJson解析 生成json文件 读取json文件中的字典
如何利用FME 创建自己的功能软件
你清楚AI、数据库与计算机体系
Dripping backward (II)
[operation] getting started with MySQL on May 23, 2022
Global and Chinese market of bulk acoustic wave devices 2022-2028: Research Report on technology, participants, trends, market size and share
C#【高级篇】 C# 泛型(Generic)【需进一步补充:泛型接口、泛型事件的实例】
【论文阅读|深读】DANE:Deep Attributed Network Embedding
Number of students from junior college to Senior College (4)
[punch in - Blue Bridge Cup] day 3 --- slice in reverse order list[: -1]
声网自研传输层协议 AUT 的落地实践丨Dev for Dev 专栏
[note] Introduction to data analysis on June 7, 2022
Stc89c52/90c516rd/89c516rd DHT11 temperature and humidity sensor drive code