当前位置:网站首页>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
边栏推荐
- 1151_ Makefile learning_ Static matching pattern rules in makefile
- [note] Introduction to data analysis on June 7, 2022
- 【笔记】2022.5.23 MySQL
- Feign 坑
- Laravel9 local installation
- Product thinking - is the future of UAV express worth looking forward to?
- Stc89c52/90c516rd/89c516rd ADC0832 ADC driver code
- [summary of skimming questions] database questions are summarized by knowledge points (continuous update / simple and medium questions have been completed)
- 【作业】2022.5.28 将CSV写入数据库
- C#【高级篇】 C# 泛型(Generic)【需进一步补充:泛型接口、泛型事件的实例】
猜你喜欢

Practical debugging skills

Linked list: insert a node in the head

Redis is used in Windows system

Laravel9 local installation

Postman learning sharing

Hisense A7 ink screen mobile phone cannot be started

Laravel9 installation locale

华为云原生——数据开发与DataFactory

【论文阅读|深读】Role2Vec:Role-Based Graph Embeddings

MySQL performance optimization (5): principle and implementation of master-slave synchronization
随机推荐
Tidb 6.0: making Tso more efficient tidb Book rush
A minimalist way to integrate databinding into activity/fragment
【常见问题】页面跨域和接口跨域
Vscode+anaconda+jupyter reports an error: kernel did with exit code
Mysql性能优化(5):主从同步原理与实现
将DataBinding整合到Activity/Fragment的一种极简方式
Note: load the configuration file as a byte stream and get the resources in it
【笔记】2022.5.23 MySQL
(03).NET MAUI实战 基础控件
【笔记】2022.6.7 数据分析概论
专升本语文资源整理
Ubuntu20.04 PostgreSQL 14 installation configuration record
Arrangement of language resources of upgraded version
ReSharper 7. Can X be used with vs2013 preview? [off] - can resharper 7 x be used with VS2013 preview? [closed]
ThingsBoard教程(二三):在规则链中计算二个设备的温度差
Redis高并发分布式锁(学习总结)
Postman learning sharing
1152_ Makefile learning_ Pattern matching rules
Number of students from junior college to Senior College (III)
Global and Chinese market of bulk acoustic wave devices 2022-2028: Research Report on technology, participants, trends, market size and share