
    jj=
                     ^    S SK Jr  S SKrS SKJr  S SKJrJrJrJ	r	  S SK
Jr  S	S jrS rS rg)
    )warnN)
MultiPoint)LINE_GEOM_TYPESPOLYGON_GEOM_TYPESfrom_shapelypoints_from_xy)	GeoSeriesc                 >   [         R                  R                  US9nU b  U R                  (       a
  [	        5       $ U R
                  [        ;   a
  [        XUS9$ U R
                  [        ;   a
  [        XUS9$ [        SU R
                   S3[        SS9  [	        5       $ )a  

Sample uniformly at random from a geometry.

For polygons, this samples uniformly within the area of the polygon. For lines,
this samples uniformly along the length of the linestring. For multi-part
geometries, the weights of each part are selected according to their relevant
attribute (area for Polygons, length for LineStrings), and then points are
sampled from each part uniformly.

Any other geometry type (e.g. Point, GeometryCollection) are ignored, and an
empty MultiPoint geometry is returned.

Parameters
----------
geom : any shapely.geometry.BaseGeometry type
    the shape that describes the area in which to sample.

size : integer
    an integer denoting how many points to sample

Returns
-------
shapely.MultiPoint geometry containing the sampled points

Examples
--------
>>> from shapely.geometry import box
>>> square = box(0,0,1,1)
>>> uniform(square, size=102) # doctest: +SKIP
)seed)size	generatorzSampling is not supported for z geometry type.   )
stacklevel)numpyrandomdefault_rngis_emptyr   	geom_typer   _uniform_polygonr   _uniform_liner   UserWarning)geomr   rngr   s       Z/var/www/html/Sattelite-Image/venv/lib/python3.13/site-packages/geopandas/tools/_random.pyuniformr      s    @ ((c(2I|t}}|~~++9EE~~(T	BB
((8H
 <    c                 n    UR                  US9n[        U R                  USS95      R                  5       $ )z/Sample points from an input shapely linestring.r   T)
normalized)r   r   interpolate	union_all)r   r   r   fracss       r   r   r   C   s9    4(E((4(@AKKMMr   c           	      d   U R                   u  p4pV/ n[        U5      U:  ad  [        UR                  X5US9UR                  XFUS9S9nXR                  R                  U SS9   n	UR                  U	5        [        U5      U:  a  Md  UR                  U5        [        USU 5      R                  5       $ )z>Sample uniformly from within a polygon using batched sampling.r   )xycontains)	predicateN)
boundslenr   r   sindexqueryextendshuffler	   r!   )
r   r   r   xminyminxmaxymax
candidatesbatchvalid_sampless
             r   r   r   I   s    ![[DJ
j/D
 66
 ll000LM-( j/D
  j!Z&'1133r   )N)warningsr   r   shapely.geometryr   geopandas.arrayr   r   r   r   geopandas.geoseriesr	   r   r   r    r   r   <module>r:      s.      '  *0fN4r   