
    !\i                         S r SSKrSSK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 " S S5      r\R$                  " 5       \	R&                  \	R(                  \R*                  \R,                  \R.                  \R0                  \R2                  \R4                  \R6                  " S\R8                  SS	S
9\R:                  S 5       5       5       5       5       5       5       5       5       5       5       rg)z9rio blocks prints a dataset's blocks as GeoJSON features.    N)options)write_features)transform_boundsc                   >    \ rS rSrSrS	S jrS r\S 5       rS r	Sr
g)
_Collection   z5For use with `rasterio.rio.helpers.write_features()`.c                 4    Xl         X l        X0l        X@l        g)av  Export raster dataset windows to GeoJSON polygon features.

Parameters
----------
dataset : a dataset object opened in 'r' mode
    Source dataset
bidx : int
    Extract windows from this band
precision : int, optional
    Coordinate precision
geographic : bool, optional
    Reproject geometries to ``EPSG:4326`` if ``True``

Yields
------
dict
    GeoJSON polygon feature
N)_src_bidx
_precision_geographic)selfdatasetbidx	precision
geographics        V/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/rasterio/rio/blocks.py__init___Collection.__init__   s    * 	
#%    c                    ^  T R                   (       a!  [        T R                  R                  S/UQ76 nT R                  S:  a  U 4S jU 5       nU$ )Nz	EPSG:4326r   c              3   P   >#    U  H  n[        UTR                  5      v   M     g 7fN)roundr   ).0vr   s     r   	<genexpr>0_Collection._normalize_bounds.<locals>.<genexpr>5   s     @AeAt//s   #&)r   r   r
   crsr   )r   boundss   ` r   _normalize_bounds_Collection._normalize_bounds1   s@    %diimm[J6JF??a@@Fr   c                 ^    [        U R                  U R                  R                  5      5      $ r   )tupler!   r
   r    )r   s    r   bbox_Collection.bbox8   s"    T++DII,<,<=>>r   c           
   #     #    U R                   R                  U R                  S9n[        U5       H  u  nu  p4U R	                  U R                   R                  U5      5      nUu  pgpS[        R                  R                  U R                   R                  5       SU 3[        R                  " U5      UR                  5       S.SXg4Xi4X4X4//S.S.v   M     g 7f)N)r   Feature:)blockwindowPolygon)typecoordinates)r-   id
propertiesgeometry)r
   block_windowsr   	enumerater!   window_boundsospathbasenamenamejsondumpstodict)
r   genidxr*   r+   r    xminyminxmaxymaxs
             r   __call___Collection.__call__<   s     ii%%4::%6$-cN C%++DII,C,CF,KLF%+"D!))$))..9:!C5A!ZZ.$mmo
 &	% $  %3s   CC)r   r   r   r
   N)   T)__name__
__module____qualname____firstlineno____doc__r   r!   propertyr%   rB   __static_attributes__ r   r   r   r      s(    ?&4 ? ?r   r   z--bidxz/Index of the band that is the source of shapes.)r-   defaulthelpc
           	         SS0n
U(       a  XJS'   U(       a  SU
S'   U(       a  [         R                  " US5      O[         R                  " S5      nU R                  S      [        R
                  " U5       nU	(       a%  XR                  ;  a  [         R                  " S	5      e[        UU	UUS
:g  S9n[        UU4UU(       a  SOSUS.U
D6  SSS5        SSS5        g! , (       d  f       N= f! , (       d  f       g= f)a  Write dataset blocks as GeoJSON features.

This command prints features describing a raster's internal blocks,
which are used directly for raster I/O.  These features can be used
to visualize how a windowed operation would operate using those
blocks.

Output features have two JSON encoded properties: block and window.
Block is a two element array like [0, 0] describing the window's
position in the input band's window layout. Window is a JSON
serialization of rasterio's Window class like {"col_off": 0,
"height": 3, "row_off": 705, "width": 791}.

Block windows are extracted from the dataset (all bands must have
matching block windows) by default, or from the band specified using
the --bidx option:


    rio blocks --bidx 3 tests/data/RGB.byte.tif

By default a GeoJSON FeatureCollection is written, but the
--sequence option produces a GeoJSON feature stream instead.


    rio blocks tests/data/RGB.byte.tif --sequence

Output features are reprojected to OGC:CRS84 (WGS 84) unless the
--projected flag is provided, which causes the output to be kept in
the input datasource's coordinate reference system.

For more information on exactly what blocks and windows represent,
see block_windows().

	sort_keysTindent),r)   
separatorswstdoutenvzNot a valid band index	projected)r   r   r   r   feature
collection)sequencegeojson_typeuse_rsN)
click	open_fileget_text_streamobjrasterioopenindexesBadParameterr   r   )ctxinputoutputr   rQ   compact
projectionrZ   r\   r   	dump_kwdsrU   srcrY   s                 r   blocksrl   T   s    d d#I$(",	,  __$)$9$9($C  
u-D+$$%=>> ![0	

 		
 &.L	
 	
 .--s%   C.6ACC.
C+	'C..
C<)rI   r9   loggingos.pathr5   r]   cligjra   rasterio.rior   rasterio.rio.helpersr   rasterio.warpr   	getLoggerrE   loggerr   commandfile_in_arg
output_optprecision_opt
indent_optcompact_optprojection_projected_optsequence_opt
use_rs_optoptionINTpass_contextrl   rL   r   r   <module>r      s    ?         / * 
		8	$> >B 599a	:< A
 <          A
r   