python shapely函数 笔记

Shapely是一个Python库,用于操作和分析笛卡尔坐标系中的几何对象。https://shapely.readthedocs.io/en/latest/manual.html#empty-features

引用原文地址:https://blog.csdn.net/wiborgite/article/details/85167397

函数类型

Shapely包提供的函数

获取属性(各种几何对象共有的属性)

获取面积

object.area

获取边界

object.bounds

获取长度

object.length

获取类型

object.geom_type

获取距离

object.distance(other)

获取hausdorff距离

object.hausdorff_distance(other)

获取representative点

object.representative_point()

转换为wkt格式

object.wkt

是否为空

object.is_empty

是否包含z坐标

object.has_z

是否是有效对象

object.is_valid

获取包含对象的最小凸多边形

object.convex_hull

获取包含对象的最小矩形

object.envelope

获取包含对象的最小边界矩形

object.minimum_rotated_rectangle

获取对象右侧或左侧的一个LineString或MultiLineString

object.parallel_offset(distance, side, resolution=16, join_style=1, mitre_limit=5.0)

获取对象的一个简单表示

object.simplify(tolerance, preserve_topology=True)

点的处理

获取点的坐标

point.coords[:]

线的处理

获取线的坐标

line.coords

是否为闭环

line.is_ring

是否是简单的

line.is_simple

线性环LineraRings

获取线性环的坐标

ring.coords

坐标是否为逆时针

ring.is_ccw

是否为闭环

ring.is_ring

多边形

 

获取多边形的外环坐标

polygon.exterior.coords

获取多边形的内环

polygon.interiors

集合

获取集合中各对象的类型

collection.geoms

list(collection.geoms)

len(collection.geoms)

除collection类型为,其它集合类型如Multipoint、MultiLineString、MulitPolygon也支持这些操作。

获取两个对象的关系

是否完全相同:类型和坐标都相同

object.__eq__(other)

是否相同:边界、interior和exterior相同

object.equals(other)

是否近似相同

object.almost_equals(other[, decimal=6])

是否包含

object.contains(other)

是否反向包含

object.within(other)

是否交叉

object.crosses(other)

是否反向交叉

object.disjoint(other)

是否交叉

object.intersects(other)

是否覆盖

object.overlaps(other)

是否接触

object.touches(other)

创建新的对象

差集

object.difference(other)

交集

object.intersection(other)

对称差集

object.symmetric_difference(other)

并集

object.union(other)

 

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值