root/Shapely/trunk/tests/Operations.txt

Revision 739 (checked in by seang, 2 years ago)

Add area, length, and distance

  • Property svn:eol-style set to native
Line 
1 Test GEOS operations
2 ====================
3
4   >>> from shapely.geometry import Point
5   >>> point = Point(0.0, 0.0)
6
7 General geometry
8 ----------------
9
10   >>> point.area
11   0.0
12
13   >>> point.length
14   0.0
15
16   >>> point.distance(Point(-1.0, -1.0))
17   1.4142135623730951
18
19 Topology operations
20 -------------------
21
22   Envelope
23
24   >>> point.envelope #doctest: +ELLIPSIS
25   <shapely.geometry.point.Point object at ...>
26
27   Intersection
28
29   >>> point.intersection(Point(-1,-1)) #doctest: +ELLIPSIS
30   <shapely.geometry.collection.GeometryCollection object at ...>
31  
32   Buffer
33
34   >>> point.buffer(10.0) #doctest: +ELLIPSIS
35   <shapely.geometry.polygon.Polygon object at ...>
36  
37   >>> point.buffer(10.0, 32) #doctest: +ELLIPSIS
38   <shapely.geometry.polygon.Polygon object at ...>
39
40   Convex Hull
41
42   >>> point.convex_hull #doctest: +ELLIPSIS
43   <shapely.geometry.point.Point object at ...>
44  
45   Differences
46
47   >>> point.difference(Point(-1, 1)) #doctest: +ELLIPSIS
48   <shapely.geometry.point.Point object at ...>
49  
50   >>> point.symmetric_difference(Point(-1, 1)) #doctest: +ELLIPSIS
51   <shapely.geometry.multipoint.MultiPoint object at ...>
52  
53   Boundary
54
55   >>> point.boundary #doctest: +ELLIPSIS
56   <shapely.geometry.collection.GeometryCollection object at ...>
57  
58   Union
59
60   >>> point.union(Point(-1, 1)) #doctest: +ELLIPSIS
61   <shapely.geometry.multipoint.MultiPoint object at ...>
62
63   Point on Surface (TODO?)
64
65   >>> point.centroid #doctest: +ELLIPSIS
66   <shapely.geometry.point.Point object at ...>
67
68   Relate
69
70   >>> point.relate(Point(-1, -1)) #doctest: +ELLIPSIS
71   'FF0FFF0F2'
72
Note: See TracBrowser for help on using the browser.