Changeset 1007

Show
Ignore:
Timestamp:
01/04/08 11:03:24
Author:
seang
Message:

Add notes about bounds, x, y, z, and null geometries

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Shapely/trunk/manual/manual.txt

    r994 r1007  
    1919 
    2020.. contents:: 
     21 
    2122 
    2223Background 
     
    3435.. _wiki: http://trac.gispython.org/projects/PCL/wiki/Shapely 
    3536 
     37 
    3638Geometries 
    3739========== 
     
    4446 
    4547Shapely 1.0 does not provide circles, arcs, splines or the like. 
     48 
    4649 
    4750Factories 
     
    112115order. 
    113116 
     117 
    114118Multipart Geometry Factories 
    115119---------------------------- 
     
    156160  >>> holes = [(b1, ..., bN), ...] 
    157161  >>> lines = MultiPolygon([(shell, holes), ...]) 
     162 
     163 
     164Null Geometries 
     165--------------- 
     166 
     167Null geometries can be created by calling the factories with no arguments, but 
     168almost nothing can be done with a null geometry. 
     169 
     170.. code-block:: python 
     171 
     172  >>> line_null = LineString() 
     173  >>> line_null.length 
     174  Traceback (most recent call last): 
     175  ... 
     176  ValueError: Null geometry supports no operations 
     177 
     178The coordinates of a null geometry *can* be set (see Section 3), after which 
     179the geometry is no longer null. 
     180 
     181.. code-block:: python 
     182 
     183  >>> l_null.coords = [(0, 0), (1, 1)] 
     184  >>> print l_null.length 
     185  1.414... 
     186 
    158187 
    159188Constructive Spatial Analysis Methods 
     
    233262  'POINT (-0.0000000000000000 -0.0000000000000000)' 
    234263 
    235  
    236264Convex Hull 
    237265+++++++++++ 
     
    265293  <shapely.geometry.polygon.Polygon object at ...> 
    266294 
     295Envelope 
     296++++++++ 
     297 
     298.envelope : geometry 
     299  Returns the geometry's rectangular polygon envelope. 
     300 
     301.. code-block:: python 
     302 
     303  >>> polygon.envelope 
     304  <shapely.geometry.polygon.Polygon object at ...> 
     305 
    267306Intersection 
    268307++++++++++++ 
     
    302341  >>> hull.union(polygon) 
    303342  <shapely.geometry.polygon.Polygon object at ...> 
     343 
    304344 
    305345Unary Spatial Predicates 
     
    351391  True 
    352392  >>> polygon.has_z 
    353   True 
    354  
    355 (Note: that last return value exposes a bug in GEOS 2.2.3. Should be False.) 
     393  False 
     394 
     395(Note: that last return value exposes a bug in GEOS 2.2.3.) 
     396 
    356397 
    357398Binary Spatial Predicates 
     
    438479  The inverse of *contains*. 
    439480 
     481 
    440482General Methods 
    441483--------------- 
     
    463505  multi-polygons). 
    464506 
     507Bounds 
     508++++++ 
     509 
     510.bounds : tuple 
     511  The geometry's (minx, miny, maxx, maxy) bounding box. 
     512 
    465513Length 
    466514++++++ 
     
    477525  >>> polygon.area 
    478526  4.0 
     527  >>> polygon.bounds 
     528  (-1.0, -1.0, 1.0, 1.0) 
    479529  >>> polygon.length 
    480530  8.0 
     
    483533  >>> line_b.length 
    484534  3.9812058474788765 
     535 
    485536 
    486537Geometry Parts and Coordinates 
     
    524575  [(1.0, 1.0), (2.0, 2.0)] 
    525576 
     577 
    526578Polygon Rings 
    527579------------- 
     
    539591The interior boundaries (or holes) of a polygon can be accessed through the 
    540592*interiors* attribute, which is a list of rings. 
     593 
    541594 
    542595Sub-geometries 
     
    561614described above. 
    562615 
     616 
     617Point Coordinates 
     618----------------- 
     619 
     620For the sake of convenience the coordinate values of points can be accessed 
     621read-only via **x**, **y**, and **z** attributes: 
     622 
     623.. code-block:: python 
     624 
     625  >>> point = Point(1.0, 1.0) 
     626  >>> point.x 
     627  1.0 
     628  >>> point.y 
     629  1.0 
     630 
     631 
    563632Interoperation 
    564633============== 
     
    613682  >>> loads(feature.GetGeometryRef().ExportToWkb()) 
    614683  <shapely.geometry.polygon.Polygon object at ...> 
     684 
    615685 
    616686Python Sequences 
     
    653723  5 
    654724 
     725 
    655726Numpy Array Interface 
    656727--------------------- 
     
    695766 
    696767There is no Numpy array representation of a polygon. 
     768 
    697769 
    698770Python Geo Interface 
     
    729801.. _Python geo interface: http://trac.gispython.org/projects/PCL/wiki/PythonGeoInterface 
    730802 
     803 
    731804Advanced Features 
    732805================= 
     
    764837  ['POINT (0.5000000000000000 0.5000000000000000)'] 
    765838 
     839 
    766840Credits 
    767841=======