
    DhO$                        S r SSKJr  SSKJ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Jr  SSKJr  SSKJrJr  \R&                  " \5      r\R,                  " S	S
S9\R.                  " S5      \R0                  " SSSSSS9\R0                  " SSSSSS9\R0                  " SSSSS9\
S 5       5       5       5       5       5       r\R,                  " SSS9\R.                  " S5      \
\R0                  " SSSSSS9\R4                  \S 5       5       5       5       5       5       r\R,                  " SS S9\R.                  " S5      \R0                  " SSSSSS9\
\R0                  " S!SSS"S9S# 5       5       5       5       5       rg)$zFiona CLI commands.    )defaultdict)copyN)
use_rs_opt)map_featurereduce_features)with_context_env)obj_geneval_feature_expressionmapz0Map a pipeline expression over GeoJSON features.)
short_helppipelinez--rawz-rTFz3Print raw result, do not wrap in a GeoJSON Feature.)is_flagdefaulthelpz
--no-inputz-nzDo not read input from stream.z--dump-partszIDump parts of geometries to create new inputs before evaluating pipeline.c           	         U(       a  S/nO![         R                  " S5      n[        U5      nU H  n[        [	        XUS95       H  u  pU(       a  [         R
                  " SSS9  U(       a,  [         R
                  " [        R                  " U	5      5        MT  [        U5      n
UR                  SS5       S	U 3U
S'   XS
'   [         R
                  " [        R                  " U
5      5        M     M     g)a  Map a pipeline expression over GeoJSON features.

Given a sequence of GeoJSON features (RS-delimited or not) on stdin
this prints copies with geometries that are transformed using a
provided transformation pipeline. In "raw" output mode, this
command prints pipeline results without wrapping them in a feature
object.

The pipeline is a string that, when evaluated by fio-map, produces
a new geometry object. The pipeline consists of expressions in the
form of parenthesized lists that may contain other expressions.
The first item in a list is the name of a function or method, or an
expression that evaluates to a function. The second item is the
function's first argument or the object to which the method is
bound. The remaining list items are the positional and keyword
arguments for the named function or method. The names of the input
feature and its geometry in the context of these expressions are
"f" and "g".

For example, this pipeline expression

    '(simplify (buffer g 100.0) 5.0)'

buffers input geometries and then simplifies them so that no
vertices are closer than 5 units. Keyword arguments for the shapely
methods are supported. A keyword argument is preceded by ':' and
followed immediately by its value. For example:

    '(simplify g 5.0 :preserve_topology true)'

and

    '(buffer g 100.0 :resolution 8 :join_style 1)'

Numerical and string arguments may be replaced by expressions. The
buffer distance could be a function of a geometry's area.

    '(buffer g (/ (area g) 100.0))'

Nstdin)
dump_partsFnlid0:geometry)
clickget_text_streamr	   	enumerater   echojsondumpsr   get)r   rawno_inputr   use_rsfeaturesr   feativaluenew_feats              eC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\fiona/fio/features.pymap_cmdr+      s    F 6%%g.5>!+h"TUHA

6e,

4::e,-:$(HHT3$7#8!!=',$

4::h/0 V     filterz9Evaluate pipeline expressions to filter GeoJSON features.z--snuggs-onlyz-szPStrictly require snuggs style expressions and skip check for type of expression.c                    [         R                  " S5      n[        U5      nU(       d<   SSKJn  SSKJnJn  UR                  S5      (       d  SU S3n	UR                  W	5        U Hd  n[+        X5       HR  nU(       d  M  U(       a  [         R$                  " SSS9  [         R$                  " [&        R(                  " U5      5        MT     Mf     g! W a    [        R                  S5         NW a    [        R                  S5        [        R                  " S	[        5        [        U5       H  u  pUR!                  S
5      =(       d    U/n[        U5       H]  u  p[#        X5      (       d  M  U(       a  [         R$                  " SSS9  [         R$                  " [&        R(                  " U5      5        M_     M      gf = f)a  Evaluate pipeline expressions to filter GeoJSON features.

The pipeline is a string that, when evaluated, gives a new value for
each input feature. If the value evaluates to True, the feature
passes through the filter. Otherwise the feature does not pass.

The pipeline consists of expressions in the form of parenthesized
lists that may contain other expressions. The first item in a list
is the name of a function or method, or an expression that evaluates
to a function. The second item is the function's first argument or
the object to which the method is bound. The remaining list items
are the positional and keyword arguments for the named function or
method. The names of the input feature and its geometry in the
context of these expressions are "f" and "g".

For example, this pipeline expression

    '(< (distance g (Point 4 43)) 1)'

lets through all features that are less than one unit from the given
point and filters out all other features.

*New in version 1.10*: these parenthesized list expressions.

The older style Python expressions like

    'f.properties.area > 1000.0'

are deprecated and will not be supported in version 2.0.

r   r   )ParseException)ExpressionErrorexpr()zDetected a snuggs expression.z$Detected a legacy Python expression.ztThis style of filter expression is deprecated. Version 2.0 will only support the new parenthesized list expressions.r%   r   Fr   N)r   r   r	   pyparsing.exceptionsr/   fiona._vendor.snuggsr0   r1   
startswithparseStringloginfowarningswarnFutureWarningr   r!   r
   r   r   r    r   )ctxr   r$   snuggs_onlyr   r%   r/   r0   r1   test_stringr'   objfeatsjr&   r(   s                   r*   
filter_cmdrC   j   s[   ^ !!'*Eu~H	;B&&s++ !(1o[).  0EuJJv%0

4::d+,	 1 -  	HH45 	HH;<MMX
 $H-
+4u(/GA24BB 

6e4JJtzz$/0  0 . !	s   ;C G -CG ?G reducez1Reduce a stream of GeoJSON features to one value.z--zip-propertiesz>Zip the items of input feature properties together for output.c           
      J   [         R                  " S5      nS [        U5       5       nU(       a`  [        R                  " U5      u  pg[        [        5      nU H2  n	U	S   R                  5        H  u  pX   R                  U5        M     M4     OUn0 n[        X5       H  nU(       a  [         R                  " SSS9  U(       a,  [         R                  " [        R                  " U5      5        MR  [         R                  " [        R                  " SUUSS	.5      5        M     g
)aO  Reduce a stream of GeoJSON features to one value.

Given a sequence of GeoJSON features (RS-delimited or not) on stdin
this prints a single value using a provided transformation pipeline.

The pipeline is a string that, when evaluated, produces
a new geometry object. The pipeline consists of expressions in the
form of parenthesized lists that may contain other expressions.
The first item in a list is the name of a function or method, or an
expression that evaluates to a function. The second item is the
function's first argument or the object to which the method is
bound. The remaining list items are the positional and keyword
arguments for the named function or method. The set of geometries
of the input features in the context of these expressions is named
"c".

For example, the pipeline expression

    '(unary_union c)'

dissolves the geometries of input features.

To keep the properties of input features while reducing them to a
single feature, use the --zip-properties flag. The properties of the
input features will surface in the output feature as lists
containing the input values.

r   c              3   $   #    U  H  ov   M     g 7f)N ).0r&   s     r*   	<genexpr>reduce_cmd.<locals>.<genexpr>   s     0s   
propertiesr   Fr   Featurer   )typerK   r   r   N)r   r   r	   	itertoolsteer   listitemsappendr   r   r   r    )r   r"   r$   zip_propertiesr   r%   prop_featuresgeom_featuresrK   r&   keyvalresults                r*   
reduce_cmdrY      s    Z !!'*E00H'0}}X'>$ &
!D .446&&s+ 7 " !
!(:JJv%(JJtzz&)*JJ

 )&0$*!		 ;r,   )__doc__collectionsr   r   rN   r   loggingr:   r   cligjr   fiona.featuresr   r   	fiona.fior   fiona.fio.helpersr	   r
   	getLogger__name__r8   commandargumentoptionr+   pass_contextrC   rY   rG   r,   r*   <module>rg      s    #        7 & >! 	A 
	> 	) 	T	 91  	491x J 
	[ F-    	F-R x$WX
	> 	I	9   Y 9r,   