当前位置:网站首页>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
边栏推荐
- Node-RED系列(二八):基于OPC UA节点与西门子PLC进行通讯
- 关于智能视觉组上的机械臂
- Using virtual environments in jupyter notebook
- NER中BiLSTM-CRF解读score_sentence
- 【个人总结】学习计划
- 1152_ Makefile learning_ Pattern matching rules
- What does the hyphen mean for a block in Twig like in {% block body -%}?
- Selenium environment installation, 8 elements positioning --01
- [note] on May 28, 2022, data is obtained from the web page and written into the database
- Redis high concurrency distributed locks (learning summary)
猜你喜欢

The next change direction of database - cloud native database

Use of foreach in QT

11: I came out at 11:04 after the interview. What I asked was really too

【笔记】2022.5.23 MySQL

LitJson解析 生成json文件 读取json文件中的字典

解决navicat连接数据库遇到的问题
![[note] Introduction to data analysis on June 7, 2022](/img/8b/9119bfdd10227f5c29ca2ece192880.png)
[note] Introduction to data analysis on June 7, 2022

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

Chapter 2 control structure and function (programming problem)

Implementation of property management system with ssm+ wechat applet
随机推荐
Ubuntu20.04 PostgreSQL 14 installation configuration record
4-5 count words and spaces (15 points)
Feign pit
王爽-汇编语言 万字学习总结
How to use Jersey to get the complete rest request body- How to get full REST request body using Jersey?
[punch in - Blue Bridge Cup] day 5 --- lower() small
Postman learning sharing
Global and Chinese market for nasal drug delivery devices 2022-2028: Research Report on technology, participants, trends, market size and share
Tidb 6.0: making Tso more efficient tidb Book rush
Usage record of unity input system (instance version)
Are you a "social bull" or a "social terrorist" in the interview?
[punch in - Blue Bridge Cup] day 2 --- format output format, ASCII
Knowledge points of 2022 system integration project management engineer examination: software quality assurance and quality evaluation
MySQL performance optimization (5): principle and implementation of master-slave synchronization
【笔记】2022.5.27 通过pycharm操作MySQL
Installation and use of yarn
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
ReSharper 7. Can X be used with vs2013 preview? [off] - can resharper 7 x be used with VS2013 preview? [closed]
Vscode+anaconda+jupyter reports an error: kernel did with exit code
Arrangement of language resources of upgraded version