a
    1$eV                     @   s<  d Z ddlZddlZddlZddlZddlZddlmZ ddlm	Z	m
Z
 ddlmZmZ ddlmZ ddlmZ ed ejd	d
ejdddddejdddejddejejejejddddejejejdddddejddddejdddddejddddejejed d! ZdS )"zfio-cat    N)transform_geom)FeatureObjectEncoder)optionswith_context_env)recursive_round)AttributeFilterErrordefaultz.Concatenate and print the features of datasets)
short_helpfilesTz	INPUTS...)nargsrequiredmetavarz--layerzInput layer(s), specified as 'fileindex:layer` For example, '1:foo,2:bar' will concatenate layer foo from file 1 and layer bar from file 2)r	   multiplecallbackhelpz"--ignore-errors/--no-ignore-errorsFz)log errors but do not stop serialization.)r	   r   z--bboxzw,s,e,nz/filter for features intersecting a bounding box)r	   r   r   z--wherez'attribute filter using SQL where clausez--cut-at-antimeridianzaOptionally cut geometries at the anti-meridian. To be used only for a geographic destination CRS.)is_flagr	   r   c                 C   s  ddi}|r||d< |r d|d< |r0t || tdt|d D ]"}t|| vrBdg|t|< qBz0|rzttt|	d}W n t
y   t|}Y n0 t|dD ]\}}|t| D ]}tj|fd	|i|}|j||	d
D ]\}}|j}|rt|j|||
d}|dkr&t||}t|j|j|t|d}|rTtjddd ttj|fdti| qW d   q1 s0    Y  qqW n8 ty } ztdt| W Y d}~n
d}~0 0 dS )z
    Concatenate and print the features of input datasets as a sequence of
    GeoJSON features.

    When working with a multi-layer dataset the first layer is used by default.
    Use the '--layer' option to select a different layer.

    	sort_keysTindent),:
separators   r   r   layer)bboxwhere)Zantimeridian_cutting)id
propertiesgeometryr   F)nlclsNz'where' clause is invalid: )r   Zvalidate_multilayer_file_indexrangelenstrkeystuplemapfloatsplit
ValueErrorjsonloads	enumeratefionaopenitemsr   r   Zcrsr   r   r   r   Zboundsclickechodumpsr   r   BadParameter)ctxr   	precisionr   compactignore_errorsZdst_crsZuse_rsr   r   Zcut_at_antimeridianr   Zopen_optionsZ	dump_kwdsipathZlyrsrcZfeatZgeome r>   I/var/www/html/django/DPS/env/lib/python3.9/site-packages/fiona/fio/cat.pycat   sR    B

Fr@   )__doc__r,   warningsr2   Zcligjr/   Zfiona.transformr   Zfiona.modelr   r   Z	fiona.fior   r   Zfiona.fio.helpersr   Zfiona.errorsr   simplefiltercommandargumentoptionZcb_multilayerZprecision_optZ
indent_optZcompact_optZdst_crs_optZ
use_rs_optZopen_optpass_contextr@   r>   r>   r>   r?   <module>   sl   

	