
    !\i                        S r SSKrSSKrSSKrSSKrSSKJr  SSKJr  SSK	J
r
  \R                  " \5      r\R                  " SS9\R                  \R                   \R"                  \R$                  \R&                  \R(                  \R*                  \R,                  \R.                  \R0                  " S5      \R2                  " S	5      \R4                  " S
SSS9\R4                  " SS\SSS9\R4                  " S\SSS9\R4                  " SS	SS9\R4                  " SS	SS9\R8                  S 5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       rS rg)z$ rio shapes    N)options)dataset_features)write_featuresz+Write shapes extracted from bands or masks.)
short_helpTFz--band/--maskz6Choose to extract from a band (the default) or a mask.)defaulthelpz--bidxbandidxz7Index of the band or mask that is the source of shapes.)typer   r   z
--sampling   z:Inverse of the sampling fraction; a value of 10 decimates.z--with-nodata/--without-nodataz7Include or do not include (the default) nodata regions.z--as-mask/--not-as-maskzJInterpret a band as a mask and output only one class of valid data shapes.c                    SS0nU(       a  XOS'   U(       a  SUS'   U(       a  [         R                  " US5      O[         R                  " S5      nUc	  U
(       a  S	OUnU(       d  S
n	US:X  a  SOSnU R                  S    n[        R
                  " U5       n[        U[        UUUUU
UUUUS9	4UU	US.UD6  SSS5        SSS5        g! , (       d  f       N= f! , (       d  f       g= f)a  Extracts shapes from one band or mask of a dataset and writes
them out as GeoJSON. Unless otherwise specified, the shapes will be
transformed to WGS 84 coordinates.

The default action of this command is to extract shapes from the
first band of the input dataset. The shapes are polygons bounding
contiguous regions (or features) of the same raster value. This
command performs poorly for int16 or float type datasets.

Bands other than the first can be specified using the `--bidx`
option:

  $ rio shapes --bidx 3 tests/data/RGB.byte.tif

The valid data footprint of a dataset's i-th band can be extracted
by using the `--mask` and `--bidx` options:

  $ rio shapes --mask --bidx 1 tests/data/RGB.byte.tif

Omitting the `--bidx` option results in a footprint extracted from
the conjunction of all band masks. This is generally smaller than
any individual band's footprint.

A dataset band may be analyzed as though it were a binary mask with
the `--as-mask` option:

  $ rio shapes --as-mask --bidx 1 tests/data/RGB.byte.tif
	sort_keysTindent),:
separatorswstdoutNr   
collection
geographicFenv)samplingbandas_maskwith_nodatar   	precision)sequencegeojson_typeuse_rs)click	open_fileget_text_streamobjrasterioopenr   feature_gen)ctxinputoutputr   r   compact
projectionr   r   r   r   r	   r   r   r   	dump_kwdsr   bidxr   r   srcs                        V/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/rasterio/rio/shapes.pyshapesr/      s    r d#I$(",	,  __$)$9$9($C  D1gD##|3J	3]]5!S%# +)'
 ")  ! " 
!! 
s$    C!C	8C	
C	C
C(c                 6   ^ ^^  " UUU 4S jS5      nU" U5      $ )Nc                   <   > \ rS rSrS r\S 5       rU UU4S jrSrg)feature_gen.<locals>.Collectionr   c                     / U l         Xl        g Nbboxesr   )selfr   s     r.   __init__(feature_gen.<locals>.Collection.__init__t   s    DKH    c                     [        U R                  6 u  pp4[        U5      [        U5      [        U5      [        U5      4$ r5   )zipr7   minmax)r8   minxsminysmaxxsmaxyss        r.   bbox$feature_gen.<locals>.Collection.bboxx   s4    ),dkk):&E%u:s5z3u:s5zAAr;   c              3   ~   >#    [        T/TQ70 TD6 H%  nU R                  R                  US   5        Uv   M'     g 7f)NrD   )r   r7   append)r8   fargskwargsr-   s     r.   __call__(feature_gen.<locals>.Collection.__call__}   s:     %c;D;F;""1V9- <s   :=r6   N)	__name__
__module____qualname____firstlineno__r9   propertyrD   rK   __static_attributes__)rI   rJ   r-   s   r.   
Collectionr2   r   s(    	 
	B 
	B	 	r;   rS    )r-   r   rI   rJ   rS   s   ` `` r.   r%   r%   q   s       c?r;   )__doc__loggingr   cligjr#   rasterio.rior   rasterio.featuresr   rasterio.rio.helpersr   	getLoggerrM   loggercommandfile_in_arg
output_optprecision_opt
indent_optcompact_optprojection_geographic_optprojection_projected_optsequence_opt
use_rs_optgeojson_type_feature_optgeojson_type_bbox_optoptionintpass_contextr/   r%   rT   r;   r.   <module>rl      s          . /			8	$ GH  %U#otKMh	TLNla./ .LN'() C )N/NM $ &     !      I2CLr;   