天天看點

python Shapely 使用指南

<b>閱讀目錄</b>

<a href="http://www.cnblogs.com/kaituorensheng/p/5711752.html#_label0">引入包</a>

<a href="http://www.cnblogs.com/kaituorensheng/p/5711752.html#_label1">共有的變量和方法</a>

<a href="http://www.cnblogs.com/kaituorensheng/p/5711752.html#_label2">Point</a>

<a href="http://www.cnblogs.com/kaituorensheng/p/5711752.html#_label3">LineStrings</a>

<a href="http://www.cnblogs.com/kaituorensheng/p/5711752.html#_label4">常見格式轉換</a>

翻譯:http://toblerity.org/shapely/manual.html

object.area

  Returns the area (float) of the object.

object.bounds

  傳回對象的(minx,miny,maxx,maxy)元組(float類型)

object.length

  傳回對象的長度

object.geom_type

  傳回對象類型

object.distance(other)

  傳回本對象和另一個對象的距離

object.representative_point()

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

<a></a>

class Point(coordinates)

三種指派方式

一個點對象有area和長度都為0

坐标可以通過coords或x、y、z得到

coords可以被切片

LineStrings構造函數傳入參數是2個或多個點序列

一個LineStrings對象area為0,長度非0

獲得坐标

  &gt;&gt;&gt; list(line.coords)

  [(0.0, 0.0), (0.0, 1.0), (1.0, 2.0)]

LineString依然可以接受一個同類型對象

wkt: Well Know Text

wkb: Well Kown Binary

兩者都有loads和dumps方法

對于wkt

對于wkb

本文轉自jihite部落格園部落格,原文連結:http://www.cnblogs.com/kaituorensheng/p/5711752.html,如需轉載請自行聯系原作者