
i4Vdc           @   sz  d  Z  d d l Z d d l m Z m Z d d l m Z m Z m Z m	 Z	 m
 Z
 m Z d d l m Z d d l m Z m Z d d l m Z m Z m Z d d l m Z d d	 l m Z m Z d d
 l m Z m Z d d l m  Z  m! Z! m" Z" d d l# m$ Z$ d d l% m& Z& d e f d     YZ' d e' f d     YZ( d e' f d     YZ) d e) f d     YZ* d e' f d     YZ+ d e' f d     YZ, d e, f d     YZ- d e, f d     YZ. d e, f d     YZ/ i e( d  6e) d! 6e+ d" 6e- d# 6e. d$ 6e/ d% 6e, d& 6e* d' 6e( d  e j0 6e) d! e j0 6e+ d" e j0 6e- d# e j0 6e. d$ e j0 6e/ d% e j0 6e, d& e j0 6Z1 d S((   s  
 The OGRGeometry is a wrapper for using the OGR Geometry class
 (see http://www.gdal.org/ogr/classOGRGeometry.html).  OGRGeometry
 may be instantiated when reading geometries from OGR Data Sources
 (e.g. SHP files), or when given OGC WKT (a string).

 While the 'full' API is not present yet, the API is "pythonic" unlike
 the traditional and "next-generation" OGR Python bindings.  One major
 advantage OGR Geometries have over their GEOS counterparts is support
 for spatial reference systems and their transformation.

 Example:
  >>> from django.contrib.gis.gdal import OGRGeometry, OGRGeomType, SpatialReference
  >>> wkt1, wkt2 = 'POINT(-90 30)', 'POLYGON((0 0, 5 0, 5 5, 0 5)'
  >>> pnt = OGRGeometry(wkt1)
  >>> print(pnt)
  POINT (-90 30)
  >>> mpnt = OGRGeometry(OGRGeomType('MultiPoint'), SpatialReference('WGS84'))
  >>> mpnt.add(wkt1)
  >>> mpnt.add(wkt1)
  >>> print(mpnt)
  MULTIPOINT (-90 30,-90 30)
  >>> print(mpnt.srs.name)
  WGS 84
  >>> print(mpnt.srs.proj)
  +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
  >>> mpnt.transform_to(SpatialReference('NAD27'))
  >>> print(mpnt.proj)
  +proj=longlat +ellps=clrk66 +datum=NAD27 +no_defs
  >>> print(mpnt)
  MULTIPOINT (-89.999930378602485 29.999797886557641,-89.999930378602485 29.999797886557641)

  The OGRGeomType class is to make it easy to specify an OGR geometry type:
  >>> from django.contrib.gis.gdal import OGRGeomType
  >>> gt1 = OGRGeomType(3) # Using an integer for the type
  >>> gt2 = OGRGeomType('Polygon') # Using a string
  >>> gt3 = OGRGeomType('POLYGON') # It's case-insensitive
  >>> print(gt1 == 3, gt1 == 'Polygon') # Equivalence works w/non-OGRGeomType objects
  True True
iN(   t   a2b_hext   b2a_hex(   t   byreft   c_char_pt   c_doublet   c_ubytet   c_void_pt	   string_at(   t   GDALBase(   t   Envelopet   OGREnvelope(   t   GDALExceptiont   OGRIndexErrort   SRSException(   t   OGRGeomType(   t   geomt   srs(   t   CoordTransformt   SpatialReference(   t	   hex_regext
   json_regext	   wkt_regex(   t   six(   t   ranget   OGRGeometryc           B   s  e  Z d  Z d: d  Z d   Z d   Z d   Z e d    Z	 d   Z
 d   Z d   Z d	   Z d
   Z d   Z d   Z e d    Z d   Z d   Z e e e  Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z d   Z d   Z  e e e   Z! d   Z" d   Z# e e" e#  Z$ e d    Z% e d    Z& e d    Z' e d     Z( e( Z) e d!    Z* e d"    Z+ e d#    Z, e d$    Z- e d%    Z. d&   Z/ d'   Z0 e1 d(  Z2 d)   Z3 d*   Z4 d+   Z5 d,   Z6 d-   Z7 d.   Z8 d/   Z9 d0   Z: d1   Z; d2   Z< d: d3  Z= e d4    Z> e d5    Z? d6   Z@ d7   ZA d8   ZB d9   ZC RS(;   s'   Generally encapsulates an OGR geometry.c         C   ss  t  | t j  } | rQ t j |  rQ t j t | j   j     } t	 } n  | rt
 j |  } t j |  } | rH| j d  r t | j d   } n  | j d  j   d k rt j t | j d   j  } t j | t t | j d  j      qt j t t | j d  j     d t t     } q"| rft j | j    } q"t |  t j t |  j  } n t  | t j  rt j t |  d t t    t |   } nU t  | t  rt j | j  } n1 t  | |  j  r| } n t d t |    | sAt d t |    n  | |  _  | r\| |  _! n  t" |  j# j |  _$ d S(   s>   Initializes Geometry on either WKT or an OGR pointer as input.t   sridt   typet
   LINEARRINGt   wkts4   Invalid input type for OGR Geometry construction: %ss)   Cannot create OGR Geometry from input: %sN(%   t
   isinstanceR   t   string_typesR   t   matcht
   memoryviewR    t   uppert   encodet   FalseR   R   t   groupt   intt   capit   create_geomR   t   numt
   import_wktR   R   t   from_wktt   NoneR   t	   from_jsont   from_wkbt   bytest   lent   ptr_typeR   R   t   strt   ptrR   t   GEO_CLASSESt	   geom_typet	   __class__(   t   selft
   geom_inputR   t   str_instancet   wkt_mt   json_mt   g(    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __init__A   s>    !	!.<
0		c         C   s&   |  j  r" t r" t j |  j   n  d S(   s   Deletes this Geometry.N(   t   _ptrR&   t   destroy_geom(   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __del__z   s    c         C   s4   |  j  } | r | j } n d  } t |  j  | f S(   N(   R   R   R+   R.   t   wkb(   R6   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __getstate__   s
    	c         C   s^   | \ } } t  j | d  t t    t |   } | sH t d   n  | |  _ | |  _ d  S(   Ns.   Invalid OGRGeometry loaded from pickled state.(	   R&   R-   R+   R   R   R/   R   R2   R   (   R6   t   stateR@   R   R2   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __setstate__   s    '	c         C   s>   | \ } } } } t  d | | | | | | | | | | f
  S(   s3   Constructs a Polygon from a bounding box (4-tuple).s,   POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))(   R   (   t   clst   bboxt   x0t   y0t   x1t   y1(    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt	   from_bbox   s    c         C   s   |  j  |  S(   s(   Returns the union of the two geometries.(   t   union(   R6   t   other(    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __or__   s    c         C   s   |  j  |  S(   s8   Returns the intersection of this Geometry and the other.(   t   intersection(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __and__   s    c         C   s   |  j  |  S(   s2   Return the difference this Geometry and the other.(   t
   difference(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __sub__   s    c         C   s   |  j  |  S(   s?   Return the symmetric difference of this Geometry and the other.(   t   sym_difference(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __xor__   s    c         C   s$   t  | t  r |  j |  St Sd S(   s$   Is this Geometry equal to the other?N(   R   R   t   equalsR#   (   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __eq__   s    c         C   s   |  | k S(   s   Tests for inequality.(    (   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __ne__   s    c         C   s   |  j  S(   s*   WKT is used for the string representation.(   R   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __str__   s    c         C   s   t  j |  j  S(   s6   Returns 0 for points, 1 for lines, and 2 for surfaces.(   R&   t   get_dimsR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt	   dimension   s    c         C   s   t  j |  j  S(   s1   Returns the coordinate dimension of the Geometry.(   R&   t   get_coord_dimR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   _get_coord_dim   s    c         C   s2   | d k r t  d   n  t j |  j |  d S(   s/   Sets the coordinate dimension of this Geometry.i   i   s(   Geometry dimension must be either 2 or 3N(   i   i   (   t
   ValueErrorR&   t   set_coord_dimR2   (   R6   t   dim(    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   _set_coord_dim   s    c         C   s   t  j |  j  S(   s(   The number of elements in this Geometry.(   R&   t   get_geom_countR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt
   geom_count   s    c         C   s   t  j |  j  S(   s.   Returns the number of Points in this Geometry.(   R&   t   get_point_countR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   point_count   s    c         C   s   |  j  S(   s7   Alias for `point_count` (same name method in GEOS API.)(   Rc   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt
   num_points   s    c         C   s   |  j  S(   s   Alais for `point_count`.(   Rc   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt
   num_coords   s    c         C   s   t  t j |  j   S(   s#   Returns the Type for this Geometry.(   R   R&   t   get_geom_typeR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR4      s    c         C   s   t  j |  j  S(   s"   Returns the Name of this Geometry.(   R&   t   get_geom_nameR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt	   geom_name   s    c         C   s   t  j |  j  S(   sI   Returns the area for a LinearRing, Polygon, or MultiPolygon; 0 otherwise.(   R&   t   get_areaR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   area   s    c         C   s"   t  t j |  j t t      S(   s'   Returns the envelope for this Geometry.(   R	   R&   t   get_envelopeR2   R   R
   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   envelope   s    c         C   s
   |  j  j S(   sD   Returns the envelope as a 4-tuple, instead of as an Envelope object.(   Rl   t   tuple(   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   extent   s    c         C   sB   y) t  j |  j  } t t j |   SWn t k
 r= d SXd S(   s0   Returns the Spatial Reference for this Geometry.N(   R&   t   get_geom_srsR2   R   t   srs_apit	   clone_srsR   R+   (   R6   t   srs_ptr(    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   _get_srs   s
    c         C   sy   t  | t  r | j } nG t  | t j t j  rL t |  } | j } n t d t |    t j	 |  j |  d S(   s,   Sets the SpatialReference for this geometry.s7   Cannot assign spatial reference with object of type: %sN(
   R   R   R2   R   t   integer_typesR   t	   TypeErrorR   R&   t
   assign_srs(   R6   R   Rr   t   sr(    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   _set_srs  s    c         C   s   |  j  } | r | j Sd  S(   N(   R   R   R+   (   R6   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt	   _get_srid  s    	c         C   s.   t  | t j  r | |  _ n t d   d  S(   Ns!   SRID must be set with an integer.(   R   R   Rt   R   Ru   (   R6   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt	   _set_srid  s    c         C   s#   d d l  m } | |  j |  j  S(   s4   Returns a GEOSGeometry object from this OGRGeometry.i(   t   GEOSGeometry(   t   django.contrib.gis.geosR{   R@   R   (   R6   R{   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   geos'  s    c         C   s   t  j |  j  S(   s/   Returns the GML representation of the Geometry.(   R&   t   to_gmlR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   gml-  s    c         C   s   t  |  j  j   S(   s=   Returns the hexadecimal representation of the WKB (a string).(   R   R@   R!   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   hex2  s    c         C   s   t  j |  j  S(   sF   
        Returns the GeoJSON representation of this Geometry.
        (   R&   t   to_jsonR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   json7  s    c         C   s   t  j |  j d  S(   s/   Returns the KML representation of the Geometry.N(   R&   t   to_kmlR2   R+   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   kml?  s    c         C   s   t  j |  j  S(   s#   Returns the size of the WKB buffer.(   R&   t   get_wkbsizeR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   wkb_sizeD  s    c         C   sf   t  j d k r d } n d } |  j } t |   } t j |  j | t |   t j	 t
 | |   S(   s/   Returns the WKB representation of the Geometry.t   littlei   i    (   t   syst	   byteorderR   R   R&   t   to_wkbR2   R   R   R    R   (   R6   R   t   szt   buf(    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR@   I  s    		c         C   s   t  j |  j t t     S(   s/   Returns the WKT representation of the Geometry.(   R&   t   to_wktR2   R   R   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   W  s    c         C   s7   |  j  } | r, | j r, d | j |  j f S|  j Sd S(   s0   Returns the EWKT representation of the Geometry.s
   SRID=%s;%sN(   R   R   R   (   R6   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   ewkt\  s    	c         C   s   t  t j |  j  |  j  S(   s   Clones this OGR Geometry.(   R   R&   t
   clone_geomR2   R   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   clonef  s    c         C   s   t  j |  j  d S(   s   
        If there are any rings within this geometry that have not been
        closed, this routine will do so by adding the starting point at the
        end.
        N(   R&   t   geom_close_ringsR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   close_ringsj  s    c         C   s   | r# |  j    } | j |  | St | t  rK t j |  j | j  nr t | t  rs t j |  j | j  nJ t | t	 j
 t	 j  r t |  } t j |  j | j  n t d   d S(   s  
        Transforms this geometry to a different spatial reference system.
        May take a CoordTransform object, a SpatialReference object, string
        WKT or PROJ.4, and/or an integer SRID.  By default nothing is returned
        and the geometry is transformed in-place.  However, if the `clone`
        keyword is set, then a transformed clone of this geometry will be
        returned.
        sU   Transform only accepts CoordTransform, SpatialReference, string, and integer objects.N(   R   t	   transformR   R   R&   t   geom_transformR2   R   t   geom_transform_toR   Rt   R   Ru   (   R6   t   coord_transR   t   kloneRw   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   s  s    	c         C   s   |  j  |  d S(   s   For backwards-compatibility.N(   R   (   R6   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   transform_to  s    c         C   s1   t  | t  s t d   n  | |  j | j  S(   s   A generalized function for topology operations, takes a GDAL function and
        the other geometry to perform the operation on.s<   Must use another OGRGeometry object for topology operations!(   R   R   Ru   R2   (   R6   t   funcRL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt	   _topology  s    c         C   s   |  j  t j |  S(   s8   Returns True if this geometry intersects with the other.(   R   R&   t   ogr_intersects(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt
   intersects  s    c         C   s   |  j  t j |  S(   s9   Returns True if this geometry is equivalent to the other.(   R   R&   t
   ogr_equals(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyRT     s    c         C   s   |  j  t j |  S(   sC   Returns True if this geometry and the other are spatially disjoint.(   R   R&   t   ogr_disjoint(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   disjoint  s    c         C   s   |  j  t j |  S(   s0   Returns True if this geometry touches the other.(   R   R&   t   ogr_touches(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   touches  s    c         C   s   |  j  t j |  S(   s0   Returns True if this geometry crosses the other.(   R   R&   t   ogr_crosses(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   crosses  s    c         C   s   |  j  t j |  S(   s2   Returns True if this geometry is within the other.(   R   R&   t
   ogr_within(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   within  s    c         C   s   |  j  t j |  S(   s1   Returns True if this geometry contains the other.(   R   R&   t   ogr_contains(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   contains  s    c         C   s   |  j  t j |  S(   s1   Returns True if this geometry overlaps the other.(   R   R&   t   ogr_overlaps(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   overlaps  s    c         C   sK   t  | t  r. t | |  j | j  |  j  St | |  j  |  j  Sd S(   s?   A helper routine for the OGR routines that generate geometries.N(   R   R   R2   R   (   R6   t   gen_funcRL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   _geomgen  s    c         C   s   |  j  t j  S(   s&   Returns the boundary of this geometry.(   R   R&   t   get_boundary(   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   boundary  s    c         C   s   |  j  t j  S(   sl   
        Returns the smallest convex Polygon that contains all the points in
        this Geometry.
        (   R   R&   t   geom_convex_hull(   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   convex_hull  s    c         C   s   |  j  t j |  S(   s   
        Returns a new geometry consisting of the region which is the difference
        of this geometry and the other.
        (   R   R&   t	   geom_diff(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyRP     s    c         C   s   |  j  t j |  S(   sy   
        Returns a new geometry consisting of the region of intersection of this
        geometry and the other.
        (   R   R&   t   geom_intersection(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyRN     s    c         C   s   |  j  t j |  S(   sr   
        Returns a new geometry which is the symmetric difference of this
        geometry and the other.
        (   R   R&   t   geom_sym_diff(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyRR     s    c         C   s   |  j  t j |  S(   s|   
        Returns a new geometry consisting of the region which is the union of
        this geometry and the other.
        (   R   R&   t
   geom_union(   R6   RL   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyRK     s    N(D   t   __name__t
   __module__t   __doc__R+   R<   R?   RA   RC   t   classmethodRJ   RM   RO   RQ   RS   RU   RV   RW   t   propertyRY   R[   R_   t	   coord_dimRa   Rc   Rd   Re   R4   Rh   Rj   Rl   Rn   Rs   Rx   R   Ry   Rz   R   R}   R   R   R   t   geojsonR   R   R@   R   R   R   R   R#   R   R   R   R   RT   R   R   R   R   R   R   R   R   R   RP   RN   RR   RK   (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   >   s|   9																	
					
											t   Pointc           B   sJ   e  Z e d     Z e d    Z e d    Z e d    Z e Z RS(   c         C   s   t  j |  j d  S(   s(   Returns the X coordinate for this Point.i    (   R&   t   getxR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   x  s    c         C   s   t  j |  j d  S(   s(   Returns the Y coordinate for this Point.i    (   R&   t   getyR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   y  s    c         C   s&   |  j  d k r" t j |  j d  Sd S(   s(   Returns the Z coordinate for this Point.i   i    N(   R   R&   t   getzR2   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   z  s    c         C   sH   |  j  d k r |  j |  j f S|  j  d k rD |  j |  j |  j f Sd S(   s    Returns the tuple of this point.i   i   N(   R   R   R   R   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyRm     s    (   R   R   R   R   R   R   Rm   t   coords(    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR     s
   t
   LineStringc           B   sn   e  Z d    Z d   Z d   Z e d    Z e Z d   Z e d    Z	 e d    Z
 e d    Z RS(   c         C   s   | d k r | |  j  k  r t   t   t   } } } t j |  j | t |  t |  t |   |  j } | d k r | j f S| d k r | j | j f S| d k r | j | j | j f Sn t d t	 |    d S(   s%   Returns the Point at the given index.i    i   i   i   s   index out of range: %sN(
   Rc   R   R&   t	   get_pointR2   R   R   t   valueR   R1   (   R6   t   indexR   R   R   R^   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __getitem__  s    .	
c         c   s'   x  t  |  j  D] } |  | Vq Wd S(   s+   Iterates over each point in the LineString.N(   R   Rc   (   R6   t   i(    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __iter__  s    c         C   s   |  j  S(   s:   The length returns the number of points in the LineString.(   Rc   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   __len__"  s    c            s&   t    f d   t t     D  S(   s4   Returns the tuple representation of this LineString.c         3   s   |  ] }   | Vq d  S(   N(    (   t   .0R   (   R6   (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pys	   <genexpr>)  s    (   Rm   R   R/   (   R6   (    (   R6   sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyRm   &  s    c         C   s/   g  t  t |    D] } | |  j |  ^ q S(   sp   
        Internal routine that returns a sequence (list) corresponding with
        the given function.
        (   R   R/   R2   (   R6   R   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   _listarr,  s    c         C   s   |  j  t j  S(   s$   Returns the X coordinates in a list.(   R   R&   R   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   3  s    c         C   s   |  j  t j  S(   s$   Returns the Y coordinates in a list.(   R   R&   R   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   8  s    c         C   s#   |  j  d k r |  j t j  Sd S(   s$   Returns the Z coordinates in a list.i   N(   R   R   R&   R   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   =  s    (   R   R   R   R   R   R   Rm   R   R   R   R   R   (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR     s   				t
   LinearRingc           B   s   e  Z RS(    (   R   R   (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   E  s   t   Polygonc           B   sk   e  Z d    Z d   Z d   Z e d    Z e Z e d    Z e Z	 e d    Z
 e d    Z RS(   c         C   s   |  j  S(   s-   The number of interior rings in this Polygon.(   Ra   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   K  s    c         c   s'   x  t  |  j  D] } |  | Vq Wd S(   s*   Iterates through each ring in the Polygon.N(   R   Ra   (   R6   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   O  s    c         C   sZ   | d k  s | |  j  k r. t d |   n( t t j t j |  j |   |  j  Sd S(   s%   Gets the ring at the specified index.i    s   index out of range: %sN(   Ra   R   R   R&   R   t   get_geom_refR2   R   (   R6   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   T  s    c         C   s   |  d S(   s"   Returns the shell of this Polygon.i    (    (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   shell\  s    c            s#   t    f d   t   j  D  S(   s0   Returns a tuple of LinearRing coordinate tuples.c         3   s   |  ] }   | j  Vq d  S(   N(   Rm   (   R   R   (   R6   (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pys	   <genexpr>e  s    (   Rm   R   Ra   (   R6   (    (   R6   sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyRm   b  s    c            s#   t    f d   t   j  D  S(   s%   The number of Points in this Polygon.c         3   s   |  ] }   | j  Vq d  S(   N(   Rc   (   R   R   (   R6   (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pys	   <genexpr>l  s    (   t   sumR   Ra   (   R6   (    (   R6   sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyRc   h  s    c         C   s,   t  t d   } t j |  j | j  | S(   s/   Returns the centroid (a Point) of this Polygon.R   (   R   R   R&   t   get_centroidR2   (   R6   t   p(    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   centroidn  s    (   R   R   R   R   R   R   R   t   exterior_ringRm   R   Rc   R   (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   I  s   			t   GeometryCollectionc           B   sV   e  Z d  Z d   Z d   Z d   Z d   Z e d    Z e d    Z	 e	 Z
 RS(   s   The Geometry Collection class.c         C   sZ   | d k  s | |  j  k r. t d |   n( t t j t j |  j |   |  j  Sd S(   s)   Gets the Geometry at the specified index.i    s   index out of range: %sN(   Ra   R   R   R&   R   R   R2   R   (   R6   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   {  s    c         c   s'   x  t  |  j  D] } |  | Vq Wd S(   s   Iterates over each Geometry.N(   R   Ra   (   R6   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR     s    c         C   s   |  j  S(   s5   The number of geometries in this Geometry Collection.(   Ra   (   R6   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR     s    c         C   s   t  | t  rd t  | |  j  rK x= | D] } t j |  j | j  q( Wq t j |  j | j  nC t  | t j  r t |  } t j |  j | j  n t d   d S(   s-   Add the geometry to this Geometry Collection.s   Must add an OGRGeometry.N(	   R   R   R5   R&   t   add_geomR2   R   R   R   (   R6   R   R;   t   tmp(    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   add  s    c            s#   t    f d   t   j  D  S(   s1   The number of Points in this Geometry Collection.c         3   s   |  ] }   | j  Vq d  S(   N(   Rc   (   R   R   (   R6   (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pys	   <genexpr>  s    (   R   R   Ra   (   R6   (    (   R6   sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyRc     s    c            s#   t    f d   t   j  D  S(   s;   Returns a tuple representation of this Geometry Collection.c         3   s   |  ] }   | j  Vq d  S(   N(   Rm   (   R   R   (   R6   (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pys	   <genexpr>  s    (   Rm   R   Ra   (   R6   (    (   R6   sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyRm     s    (   R   R   R   R   R   R   R   R   Rc   Rm   R   (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR   x  s   				t
   MultiPointc           B   s   e  Z RS(    (   R   R   (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR     s   t   MultiLineStringc           B   s   e  Z RS(    (   R   R   (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR     s   t   MultiPolygonc           B   s   e  Z RS(    (   R   R   (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyR     s   i   i   i   i   i   i   i   ie   (2   R   R   t   binasciiR    R   t   ctypesR   R   R   R   R   R   t   django.contrib.gis.gdal.baseR   t    django.contrib.gis.gdal.envelopeR	   R
   t   django.contrib.gis.gdal.errorR   R   R   t    django.contrib.gis.gdal.geomtypeR   t"   django.contrib.gis.gdal.prototypesR   R&   R   Rp   t   django.contrib.gis.gdal.srsR   R   t!   django.contrib.gis.geometry.regexR   R   R   t   django.utilsR   t   django.utils.six.movesR   R   R   R   R   R   R   R   R   R   t   wkb25bitR3   (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.pyt   <module>(   sJ   . 9//
