
    !\i                        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rS SKrS SK	J
r  \R                  " \5      r\R                  " SS9\R                   \R"                  \R$                  " SS	S
\R&                  " 5       SSS9\R(                  \R*                  \R$                  " SSSSS9\R$                  " SSSSSS9\R,                  \R.                  \R0                  S 5       5       5       5       5       5       5       5       5       5       5       r
g)    N   )resolve_inout)options)maskzMask in raster using features.)
short_helpz-j--geojson-maskgeojson_maskzwGeoJSON file to use for masking raster.  Use "-" to read from stdin.  If not provided, original raster will be returned)typedefaulthelp--cropTFzcCrop output raster to the extent of the geometries. GeoJSON must overlap input raster to use --crop)is_flagr   r   z-iz--invertz~Inverts the mask, so that areas covered by features aremasked out and areas not covered are retained.  Ignored if using --cropc
           
      4   [        XUS9u  p!US   n
Uc5  [        R                  " SSS9  [        R                  R                  X5        gU(       a  U(       a  [        R                  " SSS9  SnU R                  S	       [        R                  " U5       n[        R                  " UR                  5       5      nSSS5        SW;   a  US    Vs/ s H  oS   PM	     nnO-SU;   a  US   4nO SU;   a  U4nO[        R                  " SU
SS9e[        R                  " U
5       n [        XXgUS9u  nnUR                   nUR"                  " S0 U	D6  UR%                  SS5        U(       a  UUS'   UR#                  UWR&                  S   UR&                  S   WS.5        [        R                  " US40 UD6 nUR)                  U5        SSS5        SSS5        SSS5        g! , (       d  f       GN/= f! [         a    [        R                  " S
SS9ef = fs  snf ! [         a=  nUR                  S   S:X  a#  U(       a  [        R                  " SUSS9e SnAGN)UeSnAff = f! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       g= f)a  Masks in raster using GeoJSON features (masks out all areas not covered
by features), and optionally crops the output raster to the extent of the
features.  Features are assumed to be in the same coordinate reference
system as the input raster.

GeoJSON must be the first input file or provided from stdin:

> rio mask input.tif output.tif --geojson-mask features.json

> rio mask input.tif output.tif --geojson-mask - < features.json

If the output raster exists, it will be completely overwritten with the
results of this operation.

The result is always equal to or within the bounds of the input raster.

--crop and --invert options are mutually exclusive.

--crop option is not valid if features are completely outside extent of
input raster.
)filesoutput	overwriter   Nz3No GeoJSON provided, INPUT will be copied to OUTPUTT)errz'Invert option ignored when using --cropFenvz6GeoJSON could not be read from --geojson-mask or stdinr   )
param_hintfeaturesgeometrycoordinateszInvalid GeoJSONinput)paramr   )cropinvertall_touchedz#Input shapes do not overlap raster.z>not allowed for GeoJSON outside the extent of the input rasterr   driverr      )r   heightwidth	transformw )r   clickechorasterioshutil	copyfilesobj	open_filejsonloadsread
ValueErrorBadParameteropen	mask_toolargsprofileupdatepopshapewrite)ctxr   r   r	   r   r   r   r   r   creation_optionsr   fhgeojsonf
geometriessrc	out_imageout_transformer4   outs                        T/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/rasterio/rio/mask.pyr   r      ss   j "i9MF!HE

H	!!%0

<$G		B."**RWWY/ /  181DE1DAJ-1DJEJ7"!*-0Jg%!J$$%6e079 9 ]]5!S+4S:>AL,N(	= kkGNN.-.KK$'$*!NN #//!,"+*	  vs6g6#		)$ 79 "' 
.. 	B$$ &?0@B B	B F  	66!9 EE#00 2@ 8<<D	F F  G	. 769 "!' 
s   >J	 G5%G#;G5J	HAJ	$I8&H4BI88I'
I8J	#
G2	-G50J	2G55 HJ	
I$'0II8II$$I8'
I51I88
J	J		
J)r,   loggingr%   helpersr    r   r'   rasterio.shutilrasterio.maskr   r2   	getLogger__name__loggercommandfiles_inout_arg
output_optoptionPath
format_optall_touched_optoverwrite_optr:   pass_contextr$       rD   <module>rW      s      "    +			8	$ :;d$n::<
 	heEF dJe%& 	_%   	&F     <(_%rV   