当前位置:网站首页>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
边栏推荐
- ReSharper 7. Can X be used with vs2013 preview? [off] - can resharper 7 x be used with VS2013 preview? [closed]
- 【常见问题】浏览器环境、node环境的模块化问题
- 【作业】2022.5.25 MySQL 查操作2
- 2021-07-05
- 【笔记】2022.6.7 数据分析概论
- 【云原生】AI云开发平台——AI Model Foundry介绍(开发者可免费体验AI训练模型)
- 实用调试技巧
- Some common functions and precautions
- Product thinking - is the future of UAV express worth looking forward to?
- 第2章 控制结构和函数(编程题)
猜你喜欢
![[punch in - Blue Bridge Cup] day 3 --- slice in reverse order list[: -1]](/img/c2/13693dcb51aab565957b6c5e686b7c.jpg)
[punch in - Blue Bridge Cup] day 3 --- slice in reverse order list[: -1]

Stc89c52/90c516rd/89c516rd ADC0832 ADC driver code

(04).NET MAUI实战 MVVM

Number of students from junior college to Senior College (III)
![[ten minutes] manim installation 2022](/img/54/7b895d785c7866271f06ff49cb20aa.png)
[ten minutes] manim installation 2022

MySQL performance optimization (5): principle and implementation of master-slave synchronization
![[Note] ab Test and Variance Analysis](/img/f2/58369a99514d37d5af335a61d0911f.jpg)
[Note] ab Test and Variance Analysis

I have published a book, "changing life against the sky - the way for programmers to become gods", which is open source. I have been working for ten years. There are 100 life suggestions from technica

王爽-汇编语言 万字学习总结

How to view Tencent's 2022 school recruitment salary, the total contract of cabbage is 40W?
随机推荐
Are you a "social bull" or a "social terrorist" in the interview?
How do college students make money by programming| My way to make money in College
【笔记】2022.6.7 数据分析概论
AppData文件夹下Local,Locallow和Roaming
The next change direction of database - cloud native database
1152_ Makefile learning_ Pattern matching rules
dotnet-exec 0.5.0 released
C#【高级篇】 C# 泛型(Generic)【需进一步补充:泛型接口、泛型事件的实例】
云原生——Web实时通信技术之Websocket
【作业】2022.5.25 MySQL 查操作2
【作业】2022.5.23 MySQL入门
[frequently asked questions] modularization of browser environment and node environment
[note] on May 28, 2022, data is obtained from the web page and written into the database
将DataBinding整合到Activity/Fragment的一种极简方式
如何通过进程启动来分析和解决EasyCVR内核端口报错问题?
QT中foreach的使用
SDS understanding in redis
Product thinking - is the future of UAV express worth looking forward to?
[0x0] open questions left by the principal
Number of students from junior college to Senior College (4)