Shapely中的几何图形操作


Geometric Objects


object.area


Returns the area (float) of the object.


object.bounds


Returns a (minx, miny, maxx, maxy) tuple (float values) that bounds the object.


object.length


Returns the length (float) of the object.


object.geom_type


Returns a string specifying the Geometry Type


object.distance(other)


Returns the minimum distance (float) to the other geometric object.


object.representative_point()


Returns a cheaply computed point that is guaranteed to be within the geometric object.


Unary Predicates


object.has_z


Returns True if the feature has not only x and y, but also z coordinates for 3D (or so-called, 2.5D) geometries.


object.is_ccw


Returns True if coordinates are in counter-clockwise order (bounding a region with positive signed area). This method applies to LinearRing objects only


object.is_empty


Returns True if the feature’s interior and boundary (in point set terms) coincide with the empty set.


object.is_ring


Returns True if the feature is closed. A closed feature’s boundary coincides with the empty set.


object.is_simple


Returns True if the feature does not cross itself.


object.is_valid


Returns True if a feature is “valid” in the sense of [1].

Binary Predicates

object.almost_equals

(other[, decimal=6])


Returns True if the object is approximately equal to the other at all points to specified decimal place precision.


object.contains(other)


Returns True if the object’s interior contains the boundary and interior of the other object and their boundaries do not touch at all.


object.crosses(other)


Returns True if the interior of the object intersects the interior of the other but does not contain it, and the dimension of the intersection is less than the dimension of the one or the other.


object.disjoint(other)


Returns True if the boundary and interior of the object do not intersect at all with those of the other.


object.equals(other)


Returns True if the set-theoretic boundary, interior, and exterior of the object coincide with those of the other.


object.intersects(other)


Returns True if the boundary and interior of the object intersect in any way with those of the other.


object.touches(other)


Returns True if the objects have at least one point in common and their interiors do not intersect with any part of the other.


object.within(other)


Returns True if the object’s boundary and interior intersect only with the interior of the other (not its boundary or exterior).

DE-9IM Relationships

object.relate(other)


Returns a string representation of the DE-9IM matrix of relationships between an object’s interior, boundary, exterior and those of another geometric object.

Set-theoretic Methods

object.boundary


Returns a lower dimensional object representing the object’s set-theoretic boundary.


object.centroid


Returns a representation of the object’s geometric centroid (point).


object.difference(other)


Returns a representation of the points making up this geometric object that do not make up the other object.


object.intersection(other)


Returns a representation of the intersection of this object with the other geometric object.


object.symmetric_difference(other)


Returns a representation of the points in this object not in the other geometric object, and the points in the other not in this geometric object.


object.union(other)


Returns a representation of the union of points from this object and the other geometric object.

Constructive Methods

object.buffer

(distance, resolution=16,

cap_style=1, join_style=1,

mitre_limit=1.0)


Returns an approximate representation of all points within a given distance of the this geometric object.


object.convex_hull


Returns a representation of the smallest convex Polygon containing all the points in the object unless the number of points in the object is less than three.


object.envelope


Returns a representation of the point or smallest rectangular polygon (with sides parallel to the coordinate axes) that contains the object.


object.parallel_offset

(distance, side, resolution=16,

join_style=1, mitre_limit=1.0)


Returns a LineString or MultiLineString geometry at a distance from the object on its right or its left side.


object.simplify(tolerance,

preserve_topology=True)


Returns a simplified representation of the geometric object.

Affine Transformations

shapely.affinity.affine_transform

(geom, matrix)


Returns a transformed geometry using an affine transformation matrix.


shapely.affinity.rotate

(geom, angle, origin=‘center‘,

use_radians=False)


Returns a rotated geometry on a 2D plane.


shapely.affinity.scale

(geom, xfact=1.0, yfact=1.0,

zfact=1.0, origin=‘center‘)


Returns a scaled geometry, scaled by factors along each dimension.


shapely.affinity.skew

(geom, xs=0.0, ys=0.0,

origin=‘center‘, use_radians=False)


Returns a skewed geometry, sheared by angles along x and y dimensions.


shapely.affinity.translate

(geom, xoff=0.0, yoff=0.0, zoff=0.0)


Returns a translated geometry shifted by offsets along each dimension.


shapely.ops.transform(func, geom)


Applies func to all coordinates of geom and returns a new geometry of the same type from the transformed coordinates.

Merging Linear Features

shapely.ops.polygonize(lines)


Returns an iterator over polygons constructed from the input lines.


shapely.ops.polygonize_full(lines)


Creates polygons from a source of lines, returning the polygons and leftover geometries.


shapely.ops.linemerge(lines)


Returns a LineString or MultiLineString representing the merger of all contiguous elements of lines.

Cascading Unions

shapely.ops.cascaded_union(geoms)


Returns a representation of the union of the given geometric objects.


shapely.ops.unary_union(geoms)


Returns a representation of the union of the given geometric objects.

Prepared Geometry Operations

prepared.prep(ob)


Creates and returns a prepared geometric object.

Diagnostics

validation.explain_validity(ob)


Returns a string explaining the validity or invalidity of the object.

Interoperation--Well-Known Formats

object.wkb.encode(‘hex‘)


A Well Known Text (WKT) or Well Known Binary (WKB) representation [1] of any geometric object can be had via its wkt or wkb attribute.


object.wkt


shapely.wkb.dumps(ob)


Returns a WKB representation of ob.


shapely.wkb.loads(wkb)


Returns a geometric object from a WKB representation wkb.


shapely.wkt.dumps(ob)


Returns a WKT representation of ob.


shapely.wkt.loads(wkt)


Returns a geometric object from a WKT representation wkt.



Interoperation-- Numpy and Python Arrays


shapely.geometry.asShape()


family of functions can be used to wrap Numpy coordinate arrays so that they can then be analyzed using Shapely while maintaining their original storage



Interoperation-- Python Geo Interface


shapely.geometry.asShape(context)


Adapts the context to a geometry interface. The coordinates remain stored in the context.


shapely.geometry.shape(context)


Returns a new, independent geometry with coordinates copied from the context.


shapely.geometry.mapping(ob)


Returns a new, independent geometry with coordinates copied from the context.



Linear Referencing Methods


object.interpolate(distance[, normalized=False])


Return a point at the specified distance along a linear geometric object.


object.project

(other[, normalized=False])


Returns the distance along this geometric object to a point nearest the other object.

时间: 2024-10-22 00:53:19

Shapely中的几何图形操作的相关文章

sql的基础语句-select语句中出现的操作符号

2. select语句中出现的操作符号 2.1 合并操作符select a.ename||' '||to_char(sal) from emp a; 2.2 消除重复的行 select distinct deptno from emp; 2.3 空格.空串.null的区别 select ascii(' '),ascii(null),ascii('') from dual; 区别:  从显式上看,空串跟null在数据库中存储的值是一样的,但是NULL可以赋给任何数据类型,而空串只能赋给字符串类型

C# Winform中执行post操作并获取返回的XML类型的数据

/// <summary> /// 返回指定日期的订单数据 /// </summary> /// <param name="StartDate">起始日期</param> /// <param name="EndDate">结束日期</param> /// <returns>DataTable</returns> public System.Data.DataTable

Hibernate 中对表的操作

Hibernate CRUD testing Hibernate 中对表的操作, add,load,update,delete,list,pager(分页) package org.test.test; import java.text.SimpleDateFormat; import java.util.List; import org.hibernate.Session; import org.junit.Test; import org.zttc.itat.model.User; impo

Python中的切片操作

Python中的切片操作功能十分强大,通常我们利用切片来进行提取信息,进行相关的操作,下面就是一些切片的列子,一起来看看吧,希望对大家学习python有所帮助. 列如我们从range函数1-100中取7的倍数,函数及结果如下所示: >>> for i in range(1,100)[6::7]: print i 7 14 21 28 35 42 49 56 63 70 77 84 91 98 取一个list或tuple的部分元素是非常常见的操作.比如,一个list如下: >>

使用Json.Net解决MVC中各种json操作

最近收集了几篇文章,用于替换MVC中各种json操作,微软mvc当然用自家的序列化,速度慢不说,还容易出问题,自定义性也太差,比如得特意解决循环引用的问题,比如datetime的序列化格式,比如性能.NewtonSoft.json也就是Json.Net性能虽然不是最好的,但是是比较靠前的,其功能是最强大的,包含各种json操作模式.现在来看看mvc中的替换1, Controller.Json方法这个方法最容易出现循环引用,比如EF查出一个一对多集合想序列化,结果a引用了子表b,b中还引用了a,导

第十三篇:multimap容器和multiset容器中的find操作

前言 multimap容器是map容器的“ 增强版 ”,它允许一个键对应多个值.对于map容器来说,find函数将会返回第一个键值匹配元素所在处的迭代器.那么对于multimap容器来说,find函数将如何运作呢?如果要实现和map容器的find函数同样的功能,则它将返回多个迭代器,这样太复杂了.本文将讲解C++中multimap容器的“ find实现 ”. 解决思路一 摒弃find函数,使用另外两个新函数,它们是专家们为了解决multimap中的“ find操作 ”问题专门设计的: 1. lo

git工作中的常用操作

上班开始,打开电脑,git pull:拉取git上最新的代码: 编辑代码,准备提交时,git stash:将自己编辑的代码暂存起来,防止git pull时与库中的代码起冲突,否则自己的代码就白敲了: 然后,git pull:拉取一下代码,与库中代码,做到同步,有冲突则解决冲突,如果省了这一步,别人有提交的代码,没有更新,自己提交就会报错,再走这一步,就会把别人的代码拉取出来,然后一起提交,就相当于你提交了自己的代码,也提交了别人的代码:还有,有时这样会使库中代码乱掉,别人的心血也会丢失,你就是罪

CI中的AR操作

1 /** 2 * CI 中的 AR 操作 3 * @author zhaoyingnan 4 **/ 5 public function mAR() 6 { 7 /*************** 查询 *************/ 8 //select * from mp4ba limit 21,10; 9 //$objResult = $this->db->get('mp4ba', 10, 21); 10 //echo $this->db->last_query();die;

word中添加引文操作

word中添加引文操作 1.在文章末尾添加如下内容,并在他的下面添加一条被引文的格式