
    (&h                     T   d Z ddlZddlmZ ddlZddlZddlmZ ddl	m
Z
mZ ddlmZ ddlmZ ddlmZmZmZ g d	Zej        d
k    ZddZd Zd Z G d d          Z G d d          Z G d dej                  Z G d de          Z G d d          Z G d de          Z dS )a  Base geometry class and utilities.

Note: a third, z, coordinate value may be used when constructing
geometry objects, but has no effect on geometric analysis. All
operations are performed in the x-y plane. Thus, geometries with
different z values may intersect or be equal.
    N)warn)_geom_factory)BufferCapStyleBufferJoinStyle)CoordinateSequence)deprecate_positional)GeometryTypeErrorGEOSExceptionShapelyDeprecationWarning)Point
LineString
LinearRingPolygon
MultiPointMultiLineStringMultiPolygonGeometryCollection)      r   c                 N    t          dt          d           t          |           S )a  Create a Shapely geometry instance from a pointer to a GEOS geometry.

    .. warning::
        The GEOS library used to create the the GEOS geometry pointer
        and the GEOS library used by Shapely must be exactly the same, or
        unexpected results or segfaults may occur.

    .. deprecated:: 2.0
        Deprecated in Shapely 2.0, and will be removed in a future version.
    zaThe 'geom_factory' function is deprecated in Shapely 2.0, and will be removed in a future version   
stacklevel)r   FutureWarningr   )gparents     P/var/www/html/reinick/venv/lib/python3.11/site-packages/shapely/geometry/base.pygeom_factoryr   #   s6     		&	        c                    t          | t                    st          d| j        j        z             | j        dv r| j        dd         S | j        dk    r&| j        j        dd         d | j        D             z   S | j        	                    d          s| j        dk    rd | j
        D             S t          d	t          | j                  z             )
zADump coordinates of a geometry in the same order as data packing.z,Must be instance of a geometry class; found )r   r   r   Nr   c                 ,    g | ]}|j         d d          S N)coords).0is     r   
<listcomp>zdump_coords.<locals>.<listcomp>@   s"    )N)N)N!!(111+)N)N)Nr   Multir   c                 ,    g | ]}t          |          S  )dump_coords)r$   parts     r   r&   zdump_coords.<locals>.<listcomp>C   s     999dD!!999r   zUnhandled geometry type: )
isinstanceBaseGeometry
ValueError	__class____name__	geom_typer#   exterior	interiors
startswithgeomsr	   repr)geoms    r   r*   r*   7   s    dL)) T:T^=TT
 
 	
 
@	@	@{111~	9	$	$}#AAA&)N)Nt~)N)N)NNN		"	"7	+	+ Tt~AU/U/U99dj9999 ;d4>>R>R RSSSr   c                 D    | j         dk    r|                                 S | S )Nr   )ndimitem)results    r   _maybe_unpackr<   H   s$    {a{{}} r   c                   <    e Zd ZdZej        Zej        Zej        ZdS )	CAP_STYLEzBuffer cap styles.N)r0   
__module____qualname____doc__r   roundflatsquarer)   r   r   r>   r>   Q   s,         ED"FFFr   r>   c                   <    e Zd ZdZej        Zej        Zej        ZdS )
JOIN_STYLEzBuffer join styles.N)r0   r?   r@   rA   r   rB   mitrebevelr)   r   r   rF   rF   Y   s,        !E!E!EEEr   rF   c                   *    e Zd ZdZg Zd Zed             Zd Zd Z	d Z
 fdZd Zd	 Zd
 Zd Zd Zd Zed             Zed             Zed             Zd Zed             Zed             Zed             Zed             ZdXdZd Zed             Zed             Zd Zd Zed             Z ed             Z!ed             Z"ed              Z#ed!             Z$d" Z%d# Z&ed$             Z'ed%             Z(ed&             Z)ed'             Z* e+g d(e,)          	 	 	 	 	 dYd.            Z- e+d/ge,)          dZd1            Z.d2 Z/ e+d3ge,)          d[d5            Z0 e+d3ge,)          d[d6            Z1 e+d3ge,)          d[d7            Z2 e+d3ge,)          d[d8            Z3ed9             Z4ed:             Z5ed;             Z6ed<             Z7ed=             Z8ed>             Z9ed?             Z:d@ Z;dA Z<dB Z=dC Z>dD Z?dE Z@dF ZAdG ZBdH ZCdI ZDdJ ZEdK ZFdL ZGd\d-dNdOZHdP ZI e+dQge,)          d]dR            ZJ e+dQge,)          d]dS            ZK e+dQge,)          d]dT            ZL e+dQge,)          d]dU            ZMdV ZNdW ZO xZPS )^r-   z<Provides GEOS spatial predicates and topological operations.c                 X    t          dt          d           t          j        d          S )zDirectly calling the base class 'BaseGeometry()' is deprecated.

        This will raise an error in the future. To create an empty geometry,
        use one of the subclasses instead, for example 'GeometryCollection()'
        zDirectly calling the base class 'BaseGeometry()' is deprecated, and will raise an error in the future. To create an empty geometry, use one of the subclasses instead, for example 'GeometryCollection()'.r   r   GEOMETRYCOLLECTION EMPTYr   r   shapelyfrom_wktselfs    r   __new__zBaseGeometry.__new__f   s=     	U &	
 	
 	
 	
  :;;;r   c                 *    t          j        |           S r"   )rM   get_coordinate_dimensionrO   s    r   _ndimzBaseGeometry._ndimu   s    /555r   c                     | j         du S 5Return True if the geometry is not empty, else False.Fis_emptyrO   s    r   __bool__zBaseGeometry.__bool__y       }%%r   c                 *    |                                  S )rW   )rZ   rO   s    r   __nonzero__zBaseGeometry.__nonzero__}   s    }}r   c                    |dk    rt          j        | d          S |dk    r(t          j        | d                                          S |dk    rt          j        | d          S d}t	          j        ||          }|t          d
|           |                                \  }}|rt          |          }nd}|sd}|dv rt          j        | |d          }nA|dv rt          j        | |d          }n%|dv rt          d          t          d|           |
                                r|                                S |S )z/Format a geometry using a format specification. rounding_precisionxThexXz0(?:0?\.(?P<prec>[0-9]+))?(?P<fmt_code>[fFgGxX]?)Nzinvalid format specifier: r   )r   G)rb   trim)fFF)rc   rf   z-hex representation does not specify precisionzunhandled fmt_code: )rM   to_wktto_wkblowerre	fullmatchr.   groupsintNotImplementedErrorisupperupper)rP   format_specformat_spec_regexpmatchprecfmt_coderess          r   
__format__zBaseGeometry.__format__   s    ">$2>>>>C>$D11177999C>$D1111& 	
 /===G+GGHHHh 	t99DD D 	Hz!!.$TJJJCC##.$UKKKCC##LMMM%&GX&G&GHHH 	99;;Jr   c                     	 t                                                      }n'# t          t          f$ r d| j        j         dcY S w xY wd}t          |          |k    rd|d|dz
            dS d| dS )	/Return a string representation of the geometry.z	<shapely.z Exception in WKT writer>N   <Nr   z...>>)super__str__r
   r.   r/   r0   len)rP   wkt
max_lengthr/   s      r   __repr__zBaseGeometry.__repr__   s    	R''//##CCz* 	R 	R 	RQt~6QQQQQQ	R
 
s88j  2s+Z!^+,22223zzzs    $ !AAc                     | j         S )r}   )r   rO   s    r   r   zBaseGeometry.__str__   s	    xr   c                 H    t           j        t          j        | d          ffS )zPickle support.T)include_srid)rM   from_wkbrl   rO   s    r   
__reduce__zBaseGeometry.__reduce__   s"     7>$T#J#J#J"LMMr   c                 ,    |                      |          S )z*Return the intersection of the geometries.)intersectionrP   others     r   __and__zBaseGeometry.__and__   s      '''r   c                 ,    |                      |          S )z#Return the union of the geometries.)unionr   s     r   __or__zBaseGeometry.__or__   s    zz%   r   c                 ,    |                      |          S )z(Return the difference of the geometries.)
differencer   s     r   __sub__zBaseGeometry.__sub__   s    u%%%r   c                 ,    |                      |          S )z2Return the symmetric difference of the geometries.)symmetric_differencer   s     r   __xor__zBaseGeometry.__xor__   s    ((///r   c                 |    | j         }t          r| j        nd}t          j        | ||          }t          |          S )z6Access to geometry's coordinates (CoordinateSequence).F)	include_z	include_m)has_z_geos_ge_312has_mrM   get_coordinatesr   )rP   r   r   coords_arrays       r   r#   zBaseGeometry.coords   sA     
*5

.tuPUVVV!,///r   c                     t           )z-Separate arrays of X and Y coordinate values.rr   rO   s    r   xyzBaseGeometry.xy   
     "!r   c                     t           )z*Dictionary representation of the geometry.r   rO   s    r   __geo_interface__zBaseGeometry.__geo_interface__   r   r   c                 >    t          dt          d           | j        S )Get the geometry type (deprecated).

        .. deprecated:: 2.0
           Use the :py:attr:`geom_type` attribute instead.
        z|The 'GeometryType()' method is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.r   r   r   r   r1   rO   s    r   geometryTypezBaseGeometry.geometryType   s1     	I%		
 	
 	
 	
 ~r   c                 >    t          dt          d           | j        S )r   zuThe 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.r   r   r   rO   s    r   typezBaseGeometry.type   s1     	I%		
 	
 	
 	
 ~r   c                 .    t          j        | d          S )z#WKT representation of the geometry.r`   ra   )rM   rk   rO   s    r   r   zBaseGeometry.wkt  s     ~dr::::r   c                 *    t          j        |           S )z#WKB representation of the geometry.rM   rl   rO   s    r   wkbzBaseGeometry.wkb  s     ~d###r   c                 .    t          j        | d          S )z'WKB hex representation of the geometry.Trd   r   rO   s    r   wkb_hexzBaseGeometry.wkb_hex  s     ~d----r         ?c                     t           )zRaise NotImplementedError.r   )rP   scale_factorkwargss      r   svgzBaseGeometry.svg  s    !!r   c                 n   d}| j         r|dz   S | j        \  }}}}||k    r&||k    r |                     d          j        \  }}}}n2d}t          ||z
  ||z
  g          }||z  }||z  }||z  }||z  }||z  }||z
  }	||z
  }
t	          t          d|	g          dg          }t	          t          d|
g          dg          }	 t          |	|
g          t          ||g          z  }n# t
          $ r d}Y nw xY w| d| d|	 d|
 }d	||z    d
}| d| d| d| d| d|                     |           dS )z(SVG representation for iPython notebook.zS<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" z/>   g{Gz?g      Y@i,  r    zmatrix(1,0,0,-1,0,)zwidth="z
" height="z" viewBox="z4" preserveAspectRatio="xMinYMin meet"><g transform="z">z
</g></svg>)rY   boundsbuffermaxminZeroDivisionErrorr   )rP   svg_topxminyminxmaxymaxexpandwidest_partexpand_amountdxdywidthheightr   view_box	transforms                   r   
_repr_svg_zBaseGeometry._repr_svg_#  s   : 	 = 	T>! &*["D$dt||)-Q)>&dD$$ !4$;t"<== +f 4%%%%BBeR[))3/00E#ubk**C011F#"B8}}sE6?/C/CC$ # # #"#111111R11H;TD[;;;I Q Q5 Q QF Q Qx Q Q!*Q Q.2hh|.D.DQ Q Qs   #C( (C76C7c                 @    t           t          j        |                    S )z-Name of the geometry's type, such as 'Point'.)GEOMETRY_TYPESrM   get_type_idrO   s    r   r1   zBaseGeometry.geom_typeJ  s     g1$7788r   c                 D    t          t          j        |                     S )z&Unitless area of the geometry (float).)floatrM   arearO   s    r   r   zBaseGeometry.areaR  s     W\$''(((r   c                 F    t          t          j        | |                    S )z,Unitless distance to other geometry (float).)r<   rM   distancer   s     r   r   zBaseGeometry.distanceW      W-dE::;;;r   c                 F    t          t          j        | |                    S )z6Unitless hausdorff distance to other geometry (float).)r<   rM   hausdorff_distancer   s     r   r   zBaseGeometry.hausdorff_distance[  s    W7eDDEEEr   c                 D    t          t          j        |                     S )z(Unitless length of the geometry (float).)r   rM   lengthrO   s    r   r   zBaseGeometry.length_  s     W^D))***r   c                 D    t          t          j        |                     S )zMUnitless distance a node can be moved to produce an invalid geometry (float).)r   rM   minimum_clearancerO   s    r   r   zBaseGeometry.minimum_clearanced  s     W.t44555r   c                 *    t          j        |           S )zReturn a lower dimension geometry that bounds the object.

        The boundary of a polygon is a line, the boundary of a line is a
        collection of points. The boundary of a point is an empty (null)
        collection.
        )rM   boundaryrO   s    r   r   zBaseGeometry.boundaryl  s     %%%r   c                 h    t          t          j        |                                                     S )z8Return minimum bounding region (minx, miny, maxx, maxy).)tuplerM   r   tolistrO   s    r   r   zBaseGeometry.boundsv  s(     W^D))0022333r   c                 *    t          j        |           S )z*Return the geometric center of the object.)rM   centroidrO   s    r   r   zBaseGeometry.centroid{       %%%r   c                 *    t          j        |           S )znReturn a point guaranteed to be within the object, cheaply.

        Alias of `representative_point`.
        rM   point_on_surfacerO   s    r   r   zBaseGeometry.point_on_surface      
 '---r   c                 *    t          j        |           S )zjReturn a point guaranteed to be within the object, cheaply.

        Alias of `point_on_surface`.
        r   rO   s    r   representative_pointz!BaseGeometry.representative_point  r   r   c                 *    t          j        |           S )a  Return the convex hull of the geometry.

        Imagine an elastic band stretched around the geometry: that's a convex
        hull, more or less.

        The convex hull of a three member multipoint, for example, is a
        triangular polygon.
        )rM   convex_hullrO   s    r   r   zBaseGeometry.convex_hull  s     "4(((r   c                 *    t          j        |           S )z%A figure that envelopes the geometry.)rM   enveloperO   s    r   r   zBaseGeometry.envelope  r   r   c                 *    t          j        |           S )a  Return the oriented envelope (minimum rotated rectangle) of a geometry.

        The oriented envelope encloses an input geometry, such that the resulting
        rectangle has minimum area.

        Unlike envelope this rectangle is not constrained to be parallel to the
        coordinate axes. If the convex hull of the object is a degenerate (line
        or point) this degenerate is returned.

        The starting point of the rectangle is not fixed. You can use
        :func:`~shapely.normalize` to reorganize the rectangle to
        :ref:`strict canonical form <canonical-form>` so the starting point is
        always the lower left point.

        Alias of `minimum_rotated_rectangle`.
        rM   oriented_enveloperO   s    r   r   zBaseGeometry.oriented_envelope      $ (...r   c                 *    t          j        |           S )a  Return the oriented envelope (minimum rotated rectangle) of the geometry.

        The oriented envelope encloses an input geometry, such that the resulting
        rectangle has minimum area.

        Unlike `envelope` this rectangle is not constrained to be parallel to the
        coordinate axes. If the convex hull of the object is a degenerate (line
        or point) this degenerate is returned.

        The starting point of the rectangle is not fixed. You can use
        :func:`~shapely.normalize` to reorganize the rectangle to
        :ref:`strict canonical form <canonical-form>` so the starting point is
        always the lower left point.

        Alias of `oriented_envelope`.
        r   rO   s    r   minimum_rotated_rectanglez&BaseGeometry.minimum_rotated_rectangle  r   r   )	cap_style
join_stylemitre_limitsingle_sided)category   rB         @Fc           	         |                     dd          }|t          dt          d           |}|                     dd          }	|	t          dt          d           |	}|r:t	          |                                          d         }
t          d	|
 d
          |dk    rt          d          t          j	        |          
                                st          d          t          j        | ||||||          S )a  Get a geometry that represents all points within a distance of this geometry.

        A positive distance produces a dilation, a negative distance an
        erosion. A very small or zero distance may sometimes be used to
        "tidy" a polygon.

        Parameters
        ----------
        distance : float
            The distance to buffer around the object.
        quad_segs : int, optional
            Sets the number of line segments used to approximate an
            angle fillet.
        cap_style : shapely.BufferCapStyle or {'round', 'square', 'flat'}, default 'round'
            Specifies the shape of buffered line endings. BufferCapStyle.round
            ('round') results in circular line endings (see ``quad_segs``). Both
            BufferCapStyle.square ('square') and BufferCapStyle.flat ('flat')
            result in rectangular line endings, only BufferCapStyle.flat
            ('flat') will end at the original vertex, while
            BufferCapStyle.square ('square') involves adding the buffer width.
        join_style : shapely.BufferJoinStyle or {'round', 'mitre', 'bevel'}, default 'round'
            Specifies the shape of buffered line midpoints.
            BufferJoinStyle.ROUND ('round') results in rounded shapes.
            BufferJoinStyle.bevel ('bevel') results in a beveled edge that
            touches the original vertex. BufferJoinStyle.mitre ('mitre') results
            in a single vertex that is beveled depending on the ``mitre_limit``
            parameter.
        mitre_limit : float, optional
            The mitre limit ratio is used for very sharp corners. The
            mitre ratio is the ratio of the distance from the corner to
            the end of the mitred offset corner. When two line segments
            meet at a sharp angle, a miter join will extend the original
            geometry. To prevent unreasonable geometry, the mitre limit
            allows controlling the maximum length of the join corner.
            Corners with a ratio which exceed the limit will be beveled.
        single_sided : bool, optional
            The side used is determined by the sign of the buffer
            distance:

                a positive distance indicates the left-hand side
                a negative distance indicates the right-hand side

            The single-sided buffer of point geometries is the same as
            the regular buffer.  The End Cap Style for single-sided
            buffers is always ignored, and forced to the equivalent of
            CAP_FLAT.
        quadsegs, resolution : int, optional
            Deprecated aliases for `quad_segs`.
        **kwargs : dict, optional
            For backwards compatibility of renamed parameters. If an unsupported
            kwarg is passed, a `ValueError` will be raised.

        Returns
        -------
        Geometry

        Notes
        -----
        The return value is a strictly two-dimensional geometry. All
        Z coordinates of the original geometry will be ignored.

        .. deprecated:: 2.1.0
            A deprecation warning is shown if ``quad_segs``,  ``cap_style``,
            ``join_style``, ``mitre_limit`` or ``single_sided`` are
            specified as positional arguments. In a future release, these will
            need to be specified as keyword arguments.

        Examples
        --------
        >>> from shapely import BufferCapStyle
        >>> from shapely.wkt import loads
        >>> g = loads('POINT (0.0 0.0)')

        16-gon approx of a unit radius circle:

        >>> g.buffer(1.0).area
        3.1365484905459398

        128-gon approximation:

        >>> g.buffer(1.0, 128).area
        3.1415138011443013

        triangle approximation:

        >>> g.buffer(1.0, 3).area
        3.0
        >>> list(g.buffer(1.0, cap_style=BufferCapStyle.square).exterior.coords)
        [(1.0, 1.0), (1.0, -1.0), (-1.0, -1.0), (-1.0, 1.0), (1.0, 1.0)]
        >>> g.buffer(1.0, cap_style=BufferCapStyle.square).area
        4.0

        quadsegsNz?The `quadsegs` argument is deprecated. Use `quad_segs` instead.r   r   
resolutionz@The 'resolution' argument is deprecated. Use 'quad_segs' insteadr   z-buffer() got an unexpected keyword argument ''        z3Cannot compute offset from zero-length line segmentzbuffer distance must be finite)	quad_segsr   r   r   r   )popr   r   DeprecationWarninglistkeys	TypeErrorr.   npisfiniteallrM   r   )rP   r   r  r   r   r   r   r   r   r  kwargs              r   r   zBaseGeometry.buffer  s7   V ::j$//Q   
 !IZZd33
!R"   
 #I 	V''*ETETTTUUU#RSSSX&&**,, 	?=>>>~!#%
 
 
 	
r   preserve_topologyTc                 0    t          j        | ||          S )aS  Return a simplified geometry produced by the Douglas-Peucker algorithm.

        Coordinates of the simplified geometry will be no more than the
        tolerance distance from the original. Unless the topology preserving
        option is used, the algorithm may produce self-intersecting or
        otherwise invalid geometries.
        )r  )rM   simplify)rP   	tolerancer  s      r   r  zBaseGeometry.simplifye  s     iCTUUUUr   c                 *    t          j        |           S )a  Convert geometry to normal form (or canonical form).

        This method orders the coordinates, rings of a polygon and parts of
        multi geometries consistently. Typically useful for testing purposes
        (for example in combination with `equals_exact`).

        Examples
        --------
        >>> from shapely import MultiLineString
        >>> line = MultiLineString([[(0, 0), (1, 1)], [(3, 3), (2, 2)]])
        >>> line.normalize()
        <MULTILINESTRING ((2 2, 3 3), (0 0, 1 1))>

        )rM   	normalizerO   s    r   r  zBaseGeometry.normalizep  s      &&&r   	grid_sizeNc                 0    t          j        | ||          S )zpReturn the difference of the geometries.

        Refer to `shapely.difference` for full documentation.
        r  )rM   r   rP   r   r  s      r   r   zBaseGeometry.difference  s     !$CCCCr   c                 0    t          j        | ||          S )ztReturn the intersection of the geometries.

        Refer to `shapely.intersection` for full documentation.
        r  )rM   r   r  s      r   r   zBaseGeometry.intersection  s     #D%9EEEEr   c                 0    t          j        | ||          S )zReturn the symmetric difference of the geometries.

        Refer to `shapely.symmetric_difference` for full documentation.
        r  )rM   r   r  s      r   r   z!BaseGeometry.symmetric_difference  s     +D%9MMMMr   c                 0    t          j        | ||          S )zfReturn the union of the geometries.

        Refer to `shapely.union` for full documentation.
        r  )rM   r   r  s      r   r   zBaseGeometry.union  s     }T5I>>>>r   c                 D    t          t          j        |                     S )z<True if the geometry's coordinate sequence(s) have z values.)boolrM   r   rO   s    r   r   zBaseGeometry.has_z       GM$''(((r   c                 D    t          t          j        |                     S )z<True if the geometry's coordinate sequence(s) have m values.)r  rM   r   rO   s    r   r   zBaseGeometry.has_m  r  r   c                 D    t          t          j        |                     S )z@True if the set of points in this geometry is empty, else False.)r  rM   rY   rO   s    r   rY   zBaseGeometry.is_empty  s     G$T**+++r   c                 D    t          t          j        |                     S )z2True if the geometry is a closed ring, else False.)r  rM   is_ringrO   s    r   r!  zBaseGeometry.is_ring  s     GOD))***r   c                 ^    | j         dk    rdS t          t          j        |                     S )zcTrue if the geometry is closed, else False.

        Applicable only to linear geometries.
        r   T)r1   r  rM   	is_closedrO   s    r   r#  zBaseGeometry.is_closed  s/     >\))4G%d++,,,r   c                 D    t          t          j        |                     S )zwTrue if the geometry is simple.

        Simple means that any self-intersections are only at boundary points.
        )r  rM   	is_simplerO   s    r   r%  zBaseGeometry.is_simple  s     G%d++,,,r   c                 D    t          t          j        |                     S )zUTrue if the geometry is valid.

        The definition depends on sub-class.
        )r  rM   is_validrO   s    r   r'  zBaseGeometry.is_valid  s     G$T**+++r   c                 ,    t          j        | |          S )zFReturn the DE-9IM intersection matrix for the two geometries (string).)rM   relater   s     r   r)  zBaseGeometry.relate  s    ~dE***r   c                 F    t          t          j        | |                    S )z9Return True if the geometry covers the other, else False.)r<   rM   coversr   s     r   r+  zBaseGeometry.covers      W^D%88999r   c                 F    t          t          j        | |                    S )z@Return True if the geometry is covered by the other, else False.)r<   rM   
covered_byr   s     r   r.  zBaseGeometry.covered_by       W/e<<===r   c                 F    t          t          j        | |                    S )z;Return True if the geometry contains the other, else False.)r<   rM   containsr   s     r   r1  zBaseGeometry.contains  r   r   c                 F    t          t          j        | |                    S )zReturn True if the geometry completely contains the other.

        There should be no common boundary points.

        Refer to `shapely.contains_properly` for full documentation.
        )r<   rM   contains_properlyr   s     r   r3  zBaseGeometry.contains_properly  s     W6tUCCDDDr   c                 F    t          t          j        | |                    S )z0Return True if the geometries cross, else False.)r<   rM   crossesr   s     r   r5  zBaseGeometry.crosses      W_T599:::r   c                 F    t          t          j        | |                    S )z3Return True if geometries are disjoint, else False.)r<   rM   disjointr   s     r   r8  zBaseGeometry.disjoint  r   r   c                 F    t          t          j        | |                    S )a  Return True if geometries are equal, else False.

        This method considers point-set equality (or topological
        equality), and is equivalent to (self.within(other) &
        self.contains(other)).

        Examples
        --------
        >>> from shapely import LineString
        >>> LineString(
        ...     [(0, 0), (2, 2)]
        ... ).equals(
        ...     LineString([(0, 0), (1, 1), (2, 2)])
        ... )
        True

        Returns
        -------
        bool

        )r<   rM   equalsr   s     r   r:  zBaseGeometry.equals  s    , W^D%88999r   c                 F    t          t          j        | |                    S )z0Return True if geometries intersect, else False.)r<   rM   
intersectsr   s     r   r<  zBaseGeometry.intersects1  r/  r   c                 F    t          t          j        | |                    S )z.Return True if geometries overlap, else False.)r<   rM   overlapsr   s     r   r>  zBaseGeometry.overlaps5  r   r   c                 F    t          t          j        | |                    S )z,Return True if geometries touch, else False.)r<   rM   touchesr   s     r   r@  zBaseGeometry.touches9  r6  r   c                 F    t          t          j        | |                    S )z8Return True if geometry is within the other, else False.)r<   rM   withinr   s     r   rB  zBaseGeometry.within=  r,  r   c                 H    t          t          j        | ||                    S )zReturn True if geometry is within a given distance from the other.

        Refer to `shapely.dwithin` for full documentation.
        )r<   rM   dwithin)rP   r   r   s      r   rD  zBaseGeometry.dwithinA  s     
 W_T5(CCDDDr   r  r  c                L    t          t          j        | |||                    S )a  Return True if the geometries are equivalent within the tolerance.

        Refer to :func:`~shapely.equals_exact` for full documentation.

        Parameters
        ----------
        other : BaseGeometry
            The other geometry object in this comparison.
        tolerance : float, optional (default: 0.)
            Absolute tolerance in the same units as coordinates.
        normalize : bool, optional (default: False)
            If True, normalize the two geometries so that the coordinates are
            in the same order.

            .. versionadded:: 2.1.0

        Examples
        --------
        >>> from shapely import LineString
        >>> LineString(
        ...     [(0, 0), (2, 2)]
        ... ).equals_exact(
        ...     LineString([(0, 0), (1, 1), (2, 2)]),
        ...     1e-6
        ... )
        False

        Returns
        -------
        bool

        rE  )r<   rM   equals_exact)rP   r   r  r  s       r   rG  zBaseGeometry.equals_exactH  s.    B  ui9MMM
 
 	
r   c                 H    t          t          j        | ||                    S )zBReturn True if the DE-9IM relationship code satisfies the pattern.)r<   rM   relate_pattern)rP   r   patterns      r   rI  zBaseGeometry.relate_patternm  s    W3D%IIJJJr   
normalizedc                 J    t          t          j        | ||                    S )zReturn the distance of this geometry to a point nearest the specified point.

        If the normalized arg is True, return the distance normalized to the
        length of the linear geometry.

        Alias of `project`.
        rK  r<   rM   line_locate_pointrP   r   rK  s      r   rO  zBaseGeometry.line_locate_point|  +     %dEjIII
 
 	
r   c                 J    t          t          j        | ||                    S )zReturn the distance of geometry to a point nearest the specified point.

        If the normalized arg is True, return the distance normalized to the
        length of the linear geometry.

        Alias of `line_locate_point`.
        rM  rN  rP  s      r   projectzBaseGeometry.project  rQ  r   c                 0    t          j        | ||          S )a  Return a point at the specified distance along a linear geometry.

        Negative length values are taken as measured in the reverse
        direction from the end of the geometry. Out-of-range index
        values are handled by clamping them to the valid range of values.
        If the normalized arg is True, the distance will be interpreted as a
        fraction of the geometry's length.

        Alias of `interpolate`.
        rM  rM   line_interpolate_pointrP   r   rK  s      r   rV  z#BaseGeometry.line_interpolate_point       -dHTTTTr   c                 0    t          j        | ||          S )a  Return a point at the specified distance along a linear geometry.

        Negative length values are taken as measured in the reverse
        direction from the end of the geometry. Out-of-range index
        values are handled by clamping them to the valid range of values.
        If the normalized arg is True, the distance will be interpreted as a
        fraction of the geometry's length.

        Alias of `line_interpolate_point`.
        rM  rU  rW  s      r   interpolatezBaseGeometry.interpolate  rX  r   c                 ,    t          j        | |          S )a  Add vertices to line segments based on maximum segment length.

        Additional vertices will be added to every line segment in an input geometry
        so that segments are no longer than the provided maximum segment length. New
        vertices will evenly subdivide each segment.

        Only linear components of input geometries are densified; other geometries
        are returned unmodified.

        Parameters
        ----------
        max_segment_length : float or array_like
            Additional vertices will be added so that all line segments are no
            longer this value.  Must be greater than 0.

        Examples
        --------
        >>> from shapely import LineString, Polygon
        >>> LineString([(0, 0), (0, 10)]).segmentize(max_segment_length=5)
        <LINESTRING (0 0, 0 5, 0 10)>
        >>> Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]).segmentize(max_segment_length=5)
        <POLYGON ((0 0, 5 0, 10 0, 10 5, 10 10, 5 10, 0 10, 0 5, 0 0))>

        )rM   
segmentize)rP   max_segment_lengths     r   r\  zBaseGeometry.segmentize  s    2 !$(:;;;r   c                 *    t          j        |           S )aO  Return a copy of this geometry with the order of coordinates reversed.

        If the geometry is a polygon with interior rings, the interior rings are also
        reversed.

        Points are unchanged.

        See Also
        --------
        is_ccw : Checks if a geometry is clockwise.

        Examples
        --------
        >>> from shapely import LineString, Polygon
        >>> LineString([(0, 0), (1, 2)]).reverse()
        <LINESTRING (1 2, 0 0)>
        >>> Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]).reverse()
        <POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))>

        )rM   reverserO   s    r   r_  zBaseGeometry.reverse  s    * t$$$r   )r   )r   rB   rB   r   F)Tr"   )r  )F)Qr0   r?   r@   rA   	__slots__rQ   propertyrT   rZ   r]   r{   r   r   r   r   r   r   r   r#   r   r   r   r   r   r   r   r   r   r1   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r  r  r   r   r   r   r   r   rY   r!  r#  r%  r'  r)  r+  r.  r1  r3  r5  r8  r:  r<  r>  r@  rB  rD  rG  rI  rO  rS  rV  rZ  r\  r_  __classcell__r/   s   @r   r-   r-   a   s       FFI< < < 6 6 X6& & &  + + +Z      N N N( ( (! ! !& & &0 0 0 0 0 X0 " " X" " " X"     X ; ; X;
 $ $ X$ . . X." " " "% % %N 9 9 X9 ) ) X)< < <F F F + + X+ 6 6 X6 & & X& 4 4 X4 & & X&. . .. . . 	) 	) X	) & & X& / / X/& / / X/4 BBB#   I
 I
 I
	 I
f ./:LMMMV V V NMV' ' '8 ;-2DEEED D D FED ;-2DEEEF F F FEF ;-2DEEEN N N FEN ;-2DEEE? ? ? FE? ) ) X) ) ) X) , , X, + + X+ - - X- - - X- , , X,+ + +: : :> > >< < <E E E; ; ;< < <: : :0> > >< < <; ; ;: : :E E E#
e #
 #
 #
 #
 #
JK K K <.3EFFF

 

 

 GF

( <.3EFFF

 

 

 GF

( <.3EFFFU U U GFU* <.3EFFFU U U GFU< < <6% % % % % % %r   r-   c                   f     e Zd ZdZg Zed             Zed             Zd Zd Z	 fdZ
d
d	Z xZS )BaseMultipartGeometryz2Base class for collections of multiple geometries.c                      t          d          )zzNot implemented.

        Sub-geometries may have coordinate sequences, but multi-part geometries
        do not.
        zNSub-geometries may have coordinate sequences, but multi-part geometries do notr   rO   s    r   r#   zBaseMultipartGeometry.coords  s     "/
 
 	
r   c                      t          |           S )z#Access to the contained geometries.)GeometrySequencerO   s    r   r5   zBaseMultipartGeometry.geoms  s      %%%r   c                     | j         du S rV   rX   rO   s    r   rZ   zBaseMultipartGeometry.__bool__  r[   r   c                 ,   t          |t                    st          S t          |          t          |           u oZt	          | j                  t	          |j                  k    o0t          d t          | j        |j                  D                       S )z0Return True if geometries are equal, else False.c              3   (   K   | ]\  }}||k    V  d S r"   r)   )r$   abs      r   	<genexpr>z/BaseMultipartGeometry.__eq__.<locals>.<genexpr>  s*      DDtq!AFDDDDDDr   )r,   r-   NotImplementedr   r   r5   r  zipr   s     r   __eq__zBaseMultipartGeometry.__eq__  s    %.. 	"!!KK4::% EDJ3u{#3#33EDDs4:u{'C'CDDDDD	
r   c                 D    t                                                      S )z&Return the hash value of the geometry.)r   __hash__)rP   r/   s    r   rs  zBaseMultipartGeometry.__hash__!  s    ww!!!r   r   Nc                     | j         rdS | j        rdnddd                    fd| j        D                       z   dz   S )	az  Return a group of SVG elements for the multipart geometry.

        Parameters
        ----------
        scale_factor : float
            Multiplication factor for the SVG stroke-width.  Default is 1.
        color : str, optional
            Hex string for stroke or fill color. Default is to use "#66cc99"
            if geometry is valid, and "#ff3333" if invalid.

        z<g />Nz#66cc99z#ff3333z<g>r_   c              3   D   K   | ]}|                               V  d S r"   )r   )r$   pcolorr   s     r   rn  z,BaseMultipartGeometry.svg.<locals>.<genexpr>5  s1      NNaquu\599NNNNNNr   z</g>)rY   r'  joinr5   )rP   r   rw  s    ``r   r   zBaseMultipartGeometry.svg%  sa     = 	7=!%=IIIErwwNNNNN4:NNNNNNQWWWr   )r   N)r0   r?   r@   rA   r`  ra  r#   r5   rZ   rq  rs  r   rb  rc  s   @r   re  re    s        <<I	
 	
 X	
 & & X&& & &
 
 
" " " " "X X X X X X X Xr   re  c                   4    e Zd ZdZdZd Zd Zd Zd Zd Z	dS )rh  z@Iterative access to members of a homogeneous multipart geometry.Nc                     || _         dS )z/Initialize the sequence with a parent geometry.N)_parent)rP   r   s     r   __init__zGeometrySequence.__init__A  s    r   c                 6    t          j        | j        |          S r"   )rM   get_geometryr{  rP   r%   s     r   _get_geom_itemzGeometrySequence._get_geom_itemE  s    #DL!444r   c              #      K   t          |                                           D ]}|                     |          V  dS )z,Iterate over the geometries in the sequence.N)range__len__r  r  s     r   __iter__zGeometrySequence.__iter__H  sL      t||~~&& 	) 	)A%%a((((((	) 	)r   c                 4    t          j        | j                  S )z0Return the number of geometries in the sequence.)rM   get_num_geometriesr{  rO   s    r   r  zGeometrySequence.__len__M  s    )$,777r   c                 "   |                                  }t          |t          t          j        f          rA||z   dk     s||k    rt          d          |dk     r||z   }n|}|                     |          S t          |t                    rvg }|                    |          \  }}}t          |||          D ]*}|
                    |                     |                     + t          | j                  |pd          S t          d          )z4Access a geometry in the sequence by index or slice.r   zindex out of rangeNzkey must be an index or slice)r  r,   rq   r
  integer
IndexErrorr  sliceindicesr  appendr   r{  r	  )rP   keymr%   rz   startstopstrides           r   __getitem__zGeometrySequence.__getitem__Q  s   LLNNcC,-- 	=Qw{{cQhh !5666QwwG&&q)))U## 	=C"%++a..E45$// 3 3

4..q112222%4%%ckT222;<<<r   )
r0   r?   r@   rA   r{  r|  r  r  r  r  r)   r   r   rh  rh  8  sl        JJ G  5 5 5) ) )
8 8 8= = = = =r   rh  c                       e Zd ZdZd ZdS )EmptyGeometryzAn empty geometry.c                 X    t          dt          d           t          j        d          S )zCreate an empty geometry.zThe 'EmptyGeometry()' constructor to create an empty geometry is deprecated, and will raise an error in the future. Use one of the geometry subclasses instead, for example 'GeometryCollection()'.r   r   rK   rL   rO   s    r   rQ   zEmptyGeometry.__new__i  s;    O &	
 	
 	
 	
  :;;;r   N)r0   r?   r@   rA   rQ   r)   r   r   r  r  f  s)        	< 	< 	< 	< 	<r   r  r"   )!rA   rn   warningsr   numpyr
  rM   shapely._geometry_helpersr   shapely.constructiver   r   shapely.coordsr   shapely.decoratorsr   shapely.errorsr	   r
   r   r   geos_versionr   r   r*   r<   r>   rF   Geometryr-   re  rh  r  r)   r   r   <module>r     s    
			            3 3 3 3 3 3 @ @ @ @ @ @ @ @ - - - - - - 3 3 3 3 3 3 V V V V V V V V V V	 	 	 #z1   (T T T"  # # # # # # # #" " " " " " " "Y% Y% Y% Y% Y%7# Y% Y% Y%x8X 8X 8X 8X 8XL 8X 8X 8Xv+= += += += += += += +=\< < < < <L < < < < <r   