
    h#                        d dl Z d dlZd dlmZ d dlmZmZ d dlZd dl	m
Z
mZ d dlZd dlZd dlmZ d dlmZ d dlmZmZ dd	lmZ d
Zed   Z e ee            Zg dZdgez   Zed   Zd Zd Zg dZeeD  cg c]  } | dz   	 c} z  Zd Z 	 d)dZ!d Z"d Z#d Z$d Z%	 	 	 	 d*dZ&	 	 	 	 	 d+dZ'd,dZ(d-dZ)d-dZ*d Z+d Z,d  Z-	 	 	 	 d.d!Z.d-d"Z/d# Z0d$ Z1d% Z2d& Z3d' Z4d( Z5yc c} w )/    N)Version)Literalget_args)	DataFrameSeries)GeoDataFrame)import_optional_dependency)from_shapelyfrom_wkb   )_expand_user1.0.0)0.1.0z0.4.0z1.0.0-beta.1r   1.1.0)point
linestringpolygon
multipointmultilinestringmultipolygonWKB)r   geoarrowc                 V    t        | t              xr d| v xr | j                  d       S )Nz://)zhttp://zhttps://)
isinstancestr
startswith)urls    E/var/www/html/immo/lib/python3.12/site-packages/geopandas/io/arrow.py_is_fsspec_urlr   <   s2    3 	8SL	8677    c                     | j                         D ]Q  \  }}t        |t              rt        |       "|dk(  s(t        |t              s9|D ]  }|j                  dd        S y)aL  
    Older PROJ versions will not recognize IDs of datum ensemble members that
    were added in more recent PROJ database versions.

    Cf https://github.com/opengeospatial/geoparquet/discussions/110
    and https://github.com/OSGeo/PROJ/pull/3221

    Mimicking the patch to GDAL from https://github.com/OSGeo/gdal/pull/5872
    membersidN)itemsr   dict#_remove_id_from_member_of_ensembleslistpop)	json_dictkeyvaluemembers       r   r&   r&   D   s^      oo' '
UeT"/6I*UD"9 '

4&'	'r    )Point
LineStringr.   Polygon
MultiPointMultiLineStringMultiPolygonGeometryCollectionz Zc                    t        j                  | j                  j                        }t        j                  | j                  j                        }||xx   dz  cc<   t        |      j                         j                         }d|v r|j                  d       t        |D cg c]  }t        |    c}      S c c}w )z+Get unique geometry types from a GeoSeries.   )shapelyget_type_idarray_datahas_zr   uniquetolistremovesorted_geometry_type_names)seriesarr_geometry_typesr;   geometry_typesidxs        r   _get_geometry_typesrE   d   s     ,,V\\-?-?@MM&,,,,-Eu"./668??AN	^b!G',GHHGs   %B<c                 (   |+|r#t        d |j                         D              rd}nt        }|t        vr!t	        ddj                  t                     i }| j                  | j                  dk(     D ]  }| |   }t        |      }|d   dk(  rd	}t        |      d
k(  r|d   }nd}d}	|j                  rE|dk(  r|j                  j                         }	n%|j                  j                         }	t        |	       d|r	||v r||   ndd|	||i||<   |j                  j                         }
t!        j"                  |
      j%                         r|
||   d<   |sdddgddgddgddgdi||   d<    | j&                  ||dt(        j*                  ddS )a  Create and encode geo metadata dict.

    Parameters
    ----------
    df : GeoDataFrame
    schema_version : {'0.1.0', '0.4.0', '1.0.0-beta.1', '1.0.0', '1.1.0', None}
        GeoParquet specification version; if not provided will default to
        latest supported version.
    geometry_encoding : dict, default None
        GeoParquet encoding per geometry column.
        Defaults to "WKB" for columns that are not present in the dictionary.
    write_covering_bbox : bool, default False
        Writes the bounding box column for each row entry with column
        name 'bbox'. Writing a bbox column can be computationally
        expensive, hence is default setting is False.

    Returns
    -------
    dict
    Nc              3   &   K   | ]	  }|d k7    yw)r   N ).0encodings     r   	<genexpr>z#_create_metadata.<locals>.<genexpr>   s      %
"*H%
s   r   zschema_version must be one of: z, geometryr   0geometry_typer   rC   r   rJ   r   crsbboxxminyminxmaxymaxrQ   rR   rS   rT   covering	geopandas)libraryversion)primary_columncolumnsrY   creator)anyvaluesMETADATA_VERSIONSUPPORTED_VERSIONS
ValueErrorjoinr[   dtypesrE   lenrO   to_wktto_json_dictr&   total_boundsr=   npisfiniteall_geometry_column_namerW   __version__)dfschema_versiongeometry_encodingwrite_covering_bboxcolumn_metadatacolrA   rC   geometry_types_namerO   rP   s              r   _create_metadatart   s   s   .  %
.?.F.F.H%
 "
 %N-N//-dii8J.K-LM
 	

 Ozz"))z12 *C,V4!#"1>"a'!/!2"2::(jj'')jj--/3C8 $0A)A "#&3 
 ""))+;;t  "+/OC (#V,#V,#V,#V,	0OC ,G*Z 22"!*y7L7LM	 r    c                 J    t        j                  |       j                  d      S )zEncode metadata dict to UTF-8 JSON string.

    Parameters
    ----------
    metadata : dict

    Returns
    -------
    UTF-8 encoded JSON string
    utf-8)jsondumpsencode)metadatas    r   _encode_metadatar{      s     ::h&&w//r    c                 P    | yt        j                  | j                  d            S )zDecode a UTF-8 encoded JSON string to dict.

    Parameters
    ----------
    metadata_str : string (UTF-8 encoded)

    Returns
    -------
    dict
    Nrv   )rw   loadsdecode)metadata_strs    r   _decode_metadatar      s'     ::l))'233r    c                     t        | t              st        d      | j                  j                  dvrt        d      t        d | j                  j                  D              }|st        d      y)zValidate that the GeoDataFrame conforms to requirements for writing
    to Parquet format.

    Raises `ValueError` if the GeoDataFrame is not valid.

    copied from `pandas.io.parquet`

    Parameters
    ----------
    df : GeoDataFrame
    z;Writing to Parquet/Feather only supports IO with DataFrames>   emptystringunicodez7Writing to Parquet/Feather requires string column namesc              3   B   K   | ]  }|t        |t                y wN)r   r   )rI   names     r   rK   z&_validate_dataframe.<locals>.<genexpr>   s!      "&D<L
4s   z!Index level names must be stringsN)r   r   ra   r[   inferred_typerj   indexnames)rm   valid_namess     r   _validate_dataframer      sr     b)$VWW 
zz'EERSS  *,((.. K <== r    c           	         | st        d      | j                  d| j                  d            }|st        d      d}|D ]#  }| j                  |d      t        d| d       t        | d	   t              st        d
      d}| d	   j	                         D ]  \  }}|D ]  }||vst        d| d| d       |d   t
        vrt        dt        d|d          |j                  dd      dk(  r t        j                  d| dt        d       d|v s|d   }d|v s|d   }dD ]  }	|	|j                         vst        d        y)zValidate geo metadata.
    Must not be empty, and must contain the structure specified above.

    Raises ValueError if metadata is not valid.

    Parameters
    ----------
    metadata : dict
    9Missing or malformed geo metadata in Parquet/Feather filerY   rn   zI'geo' metadata in Parquet/Feather file is missing required key: 'version')rZ   r[   NzA'geo' metadata in Parquet/Feather file is missing required key: ''r[   z*'columns' in 'geo' metadata must be a dict)rJ   z@'geo' metadata in Parquet/Feather file is missing required key 'z' for column 'rJ   z;Only WKB geometry encoding or one of the native encodings (z) are supported, got: edgesplanar	sphericalz'The geo metadata indicate that column 'z' has spherical edges, but because GeoPandas currently does not support spherical geometry, it ignores this metadata and will interpret the edges of the geometries as planar.   
stacklevelrV   rP   rU   z&Metadata for bbox column is malformed.)ra   getr   r%   r$   SUPPORTED_ENCODINGSGEOARROW_ENCODINGSwarningswarnUserWarningkeys)
rz   rY   required_keysr*   required_col_keysrr   rq   rV   rP   vars
             r   _validate_geo_metadatar     s    TUU ll9hll3C&DEGW
 	
 2M <<T"*5  hy)40EFF & ( 3 9 9 ; S_$ 	C/) uN3%q2 	 :&.AA&) *'
346  w1[@MM9# ?, ,  (&z2H!'; SC$))+-()QRRS;Sr    c                    ddl m} ddlm} t	        |        ||dk7  r|dk7  rt        d       || ||d      \  }}t        | |||	      }	|r\d
| j                  v rt        d      | j                  }
|j                  |
d   |
d   |
d   |
d   gg d      }|j                  d
|      }|j                  j                  }|j                  dt        |	      i       |j                  |      S )zwConvert a GeoDataFrame to a pyarrow Table.

    Helper function with main, shared logic for to_parquet/to_feather.
    r   )StructArray)geopandas_to_arrowr   r   zB'geoarrow' encoding is only supported with schema version >= 1.1.0F)ro   r   interleaved)rn   ro   rp   rP   z`An existing column 'bbox' already exists in the dataframe. Please rename to write covering bbox.minxminymaxxmaxyrU   )r      geo)pyarrowr   geopandas.io._geoarrowr   r   ra   rt   r[   boundsfrom_arraysappend_columnschemarz   updater{   replace_schema_metadata)rm   r   ro   rn   rp   r   r   tablegeometry_encoding_dictgeo_metadatar   
bbox_arrayrz   s                r   _geopandas_to_arrowr   K  s    $9!%.G*CT  %7
/u%%!E! $
%0/	L RZZ8   ,,F^VF^VF^VF^L2 - 

 ##FJ7 ||$$HOOV-l;<=((22r    c                     t        dd      }t        |      }t        | ||||      }	 |j                  |	|fd|i| y)a  
    Write a GeoDataFrame to the Parquet format.

    Any geometry columns present are serialized to WKB format in the file.

    Requires 'pyarrow'.

    This is tracking version 1.0.0 of the GeoParquet specification at:
    https://github.com/opengeospatial/geoparquet. Writing older versions is
    supported using the `schema_version` keyword.

    .. versionadded:: 0.8

    Parameters
    ----------
    path : str, path object
    index : bool, default None
        If ``True``, always include the dataframe's index(es) as columns
        in the file output.
        If ``False``, the index(es) will not be written to the file.
        If ``None``, the index(ex) will be included as columns in the file
        output except `RangeIndex` which is stored as metadata only.
    compression : {'snappy', 'gzip', 'brotli', None}, default 'snappy'
        Name of the compression to use. Use ``None`` for no compression.
    geometry_encoding : {'WKB', 'geoarrow'}, default 'WKB'
        The encoding to use for the geometry columns. Defaults to "WKB"
        for maximum interoperability. Specify "geoarrow" to use one of the
        native GeoArrow-based single-geometry type encodings.
    schema_version : {'0.1.0', '0.4.0', '1.0.0', '1.1.0', None}
        GeoParquet specification version; if not provided will default to
        latest supported version.
    write_covering_bbox : bool, default False
        Writes the bounding box column for each row entry with column
        name 'bbox'. Writing a bbox column can be computationally
        expensive, hence is default setting is False.
    **kwargs
        Additional keyword arguments passed to pyarrow.parquet.write_table().
    pyarrow.parquet(pyarrow is required for Parquet support.extra)r   ro   rn   rp   compressionN)r	   r   r   write_table)
rm   pathr   r   ro   rn   rp   kwargsparquetr   s
             r   _to_parquetr     sX    ` )!KG D
+%/E GtGGGr    c                 |    t        dd      }t        |      }t        | ||      } |j                  ||fd|i| y)a  
    Write a GeoDataFrame to the Feather format.

    Any geometry columns present are serialized to WKB format in the file.

    Requires 'pyarrow' >= 0.17.

    This is tracking version 1.0.0 of the GeoParquet specification for
    the metadata at: https://github.com/opengeospatial/geoparquet. Writing
    older versions is supported using the `schema_version` keyword.

    .. versionadded:: 0.8

    Parameters
    ----------
    path : str, path object
    index : bool, default None
        If ``True``, always include the dataframe's index(es) as columns
        in the file output.
        If ``False``, the index(es) will not be written to the file.
        If ``None``, the index(ex) will be included as columns in the file
        output except `RangeIndex` which is stored as metadata only.
    compression : {'zstd', 'lz4', 'uncompressed'}, optional
        Name of the compression to use. Use ``"uncompressed"`` for no
        compression. By default uses LZ4 if available, otherwise uncompressed.
    schema_version : {'0.1.0', '0.4.0', '1.0.0', '1.1.0', None}
        GeoParquet specification version for the metadata; if not provided
        will default to latest supported version.
    kwargs
        Additional keyword arguments passed to pyarrow.feather.write_feather().
    pyarrow.feather(pyarrow is required for Feather support.r   )r   rn   r   N)r	   r   r   write_feather)rm   r   r   r   rn   r   featherr   s           r   _to_featherr     sK    @ )!KG D%OEG%I;I&Ir    c           	         |t        | j                  j                        }|d   D cg c]  }|| j                  v s| }}t	        | j                  dd      j                         j                        }|j                  |j                         t        |      st        d      |d   }t        |      r.||vr*|d   }t        |      dkD  rt        j                  dd	       | j                  |      }|i } |j                  di |}|D ]  }|d   |   }	d
|	v r!|	d
   }
t        |
t               rt#        |
       nd}
|	d   dk(  r$t%        t'        j(                  | |         |
      }n1ddlm} t/         || |   j1                         d|	d   z         |
      }|j3                  |j                  |      ||        t5        ||      S c c}w )z{Convert a pyarrow Table to a GeoDataFrame.

    Helper function with main, shared logic for read_parquet/read_feather.
    r[   r   )r*   No geometry columns are included in the columns read from
            the Parquet/Feather file.  To read this file without geometry columns,
            use pandas.read_parquet/read_feather() instead.rZ   r   zMultiple non-primary geometry columns read from Parquet/Feather file. The first column read was promoted to the primary geometry.   r   rO   z	OGC:CRS84rJ   r   )rO   )construct_shapely_arrayz	geoarrow.)rL   rH   )_validate_and_decode_metadatar   rz   column_namesr'   slice	to_pandasr[   sortr   rd   ra   r   r   dropr   r%   r&   r   rh   r9   r   r   r
   combine_chunksinsertr   )r   r   to_pandas_kwargsrr   geometry_columnsresult_column_namesrL   
table_attrrm   col_metadatarO   geom_arrr   s                r   _arrow_to_geopandasr     s   
 4U\\5J5JK
 $I.#9K9K2K  u{{1a0::<DDE1778 ?
 	
 ,-H 1A!A#A&  1$MMT ,-J				1 0	1B   A#I.s3L u%C#t$3C8 C
#u,s 4#>HF#'#J--/|J?W1W 	H 			%++C0#x@/A2 X..ws
   GGc                 (   t        | t              r||	 ddlm} |j	                  |       \  }} t        |       r3|1t        dd      } |j                  j                  | fi |xs i \  }} ||rt        d|  d      || fS # t
        $ r Y `w xY w)z
    Get the filesystem and path for a given filesystem and path.

    If the filesystem is not None then it's just returned as is.
    r   )
FileSystemfsspecz(fsspec is requred for 'storage_options'.r   z7Cannot provide 'storage_options' with non-fsspec path 'r   )r   r   
pyarrow.fsr   from_uri	Exceptionr   r	   core	url_to_fsra   )r   
filesystemstorage_optionsr   r   s        r   _get_filesystem_pathr   2  s     $!8Z=O	-)2248J d
 2+F
 16;;00Q/:ORQ
DoEdV1M
 	
 t!  	 	s   B 	BBc                     ddl m} t        | |j                        r| S 	 ddl}t        | |j
                        r |j                  |j                  |             S | S # t        $ r Y | S w xY w)a  Check if ``filesystem`` is a valid filesystem.

    Simplified version of pyarrow.fs._ensure_filesystem. This is only needed
    below because `pyarrow.parquet.read_metadata` does not yet accept a
    filesystem keyword (https://issues.apache.org/jira/browse/ARROW-16719)
    r   )fsN)	r   r   r   r   r   AbstractFileSystemPyFileSystemFSSpecHandlerImportError)r   r   r   s      r   _ensure_arrow_fsr   Q  sr     *bmm,A j&";";<??2#3#3J#?@@  
 s   A 	A)(A)c                     | d| vrt        d      	 t        | j                  dd            }t        |       |S # t        t        j
                  j                  f$ r t        d      w xY w)Nr   ziMissing geo metadata in Parquet/Feather file.
            Use pandas.read_parquet/read_feather() instead.r    r   )ra   r   r   	TypeErrorrw   decoderJSONDecodeErrorr   )rz   decoded_geo_metadatas     r   r   r   i  s|    61?
 	
V/VS0IJ /0	 t||334 VTUUVs	   ; /A*c                    ddl }ddl m} i }t        |j                        t        d      k  rt	        d      }	  |j
                  | fd|i|j                  }|j                  }|d	|vr"	 |j                  | |      j                  }||fS ||fS # t        $ r |j                  | |      }Y Vw xY w# t        $ r Y ||fS w xY w)
a>  Open the Parquet file/dataset a first time to get the schema and metadata.

    TODO: we should look into how we can reuse opened dataset for reading the
    actual data, to avoid discovering the dataset twice (problem right now is
    that the ParquetDataset interface doesn't allow passing the filters on read)

    r   N)r   z15.0.0F)use_legacy_datasetr   )r   r   )r   r   r   rl   r%   ParquetDatasetr   r   read_schemarz   read_metadata)r   r   r   r   r   r   rz   s          r   !_read_parquet_schema_and_metadatar   z  s     Fw""#gh&77/B'''NNvNUU H
 61	,,Tj,IRRH 868  B$$Tj$AB  	8	s#   B -B4 B10B14	CCc                    t        dd      }ddl}|j                  dd      }t        | ||      \  }} t	        |       } t        | |      \  }	}
t        |
      }t        |d         dk(  rt        d	      |t        ||      nd}t        |      }|s|rt        |	|      }d
|v r|j                  d
      }t        ||      }n|}d|d<    |j                  | f|||d|}t        |||      S )am  
    Load a Parquet object from the file path, returning a GeoDataFrame.

    You can read a subset of columns in the file using the ``columns`` parameter.
    However, the structure of the returned GeoDataFrame will depend on which
    columns you read:

    * if no geometry columns are read, this will raise a ``ValueError`` - you
      should use the pandas `read_parquet` method instead.
    * if the primary geometry column saved to this file is not included in
      columns, the first available geometry column will be set as the geometry
      column of the returned GeoDataFrame.

    Supports versions 0.1.0, 0.4.0 and 1.0.0 of the GeoParquet
    specification at: https://github.com/opengeospatial/geoparquet

    If 'crs' key is not present in the GeoParquet metadata associated with the
    Parquet object, it will default to "OGC:CRS84" according to the specification.

    Requires 'pyarrow'.

    .. versionadded:: 0.8

    Parameters
    ----------
    path : str, path object
    columns : list-like of strings, default=None
        If not None, only these columns will be read from the file.  If
        the primary geometry column is not included, the first secondary
        geometry read from the file will be set as the geometry column
        of the returned GeoDataFrame.  If no geometry columns are present,
        a ``ValueError`` will be raised.
    storage_options : dict, optional
        Extra options that make sense for a particular storage connection, e.g. host,
        port, username, password, etc. For HTTP(S) URLs the key-value pairs are
        forwarded to urllib as header options. For other URLs (e.g. starting with
        "s3://", and "gcs://") the key-value pairs are forwarded to fsspec. Please
        see fsspec and urllib for more details.

        When no storage options are provided and a filesystem is implemented by
        both ``pyarrow.fs`` and ``fsspec`` (e.g. "s3://") then the ``pyarrow.fs``
        filesystem is preferred. Provide the instantiated fsspec filesystem using
        the ``filesystem`` keyword if you wish to use its implementation.
    bbox : tuple, optional
        Bounding box to be used to filter selection from geoparquet data. This
        is only usable if the data was saved with the bbox covering metadata.
        Input is of the tuple format (xmin, ymin, xmax, ymax).
    to_pandas_kwargs : dict, optional
        Arguments passed to the `pa.Table.to_pandas` method for non-geometry columns.
        This can be used to control the behavior of the conversion of the non-geometry
        columns to a pandas DataFrame. For example, you can use this to control the
        dtype conversion of the columns. By default, the `to_pandas` method is called
        with no additional arguments.

    **kwargs
        Any additional kwargs passed to :func:`pyarrow.parquet.read_table`.

    Returns
    -------
    GeoDataFrame

    Examples
    --------
    >>> df = geopandas.read_parquet("data.parquet")  # doctest: +SKIP

    Specifying columns to read:

    >>> df = geopandas.read_parquet(
    ...     "data.parquet",
    ...     columns=["geometry", "pop_est"]
    ... )  # doctest: +SKIP
    r   r   r   r   Nr   )r   r   r[   r   filtersTuse_pandas_metadata)r[   r   r   )r	   geopandas.io._pyarrow_hotfixr(   r   r   r   r   rd   ra   _get_parquet_bbox_filter"_check_if_covering_in_geo_metadata_get_non_bbox_columns_splice_bbox_and_filters
read_tabler   )r   r[   r   rP   r   r   r   rW   r   r   rz   r   bbox_filterif_bbox_column_existsfilters_kwargr   r   s                    r   _read_parquetr    s6   ` )!KG ( L$/J+_J D8zJFH0:L
<	"#q(?
 	
 9=8H t4d  ?|L ,'= F

9-*=+F$(F !G*gIOE ul4DEEr    c                 ~    t        dd      }ddl}t        |       }  |j                  | fd|i|}t	        ||      S )a  
    Load a Feather object from the file path, returning a GeoDataFrame.

    You can read a subset of columns in the file using the ``columns`` parameter.
    However, the structure of the returned GeoDataFrame will depend on which
    columns you read:

    * if no geometry columns are read, this will raise a ``ValueError`` - you
      should use the pandas `read_feather` method instead.
    * if the primary geometry column saved to this file is not included in
      columns, the first available geometry column will be set as the geometry
      column of the returned GeoDataFrame.

    Supports versions 0.1.0, 0.4.0, 1.0.0 and 1.1.0 of the GeoParquet
    specification at: https://github.com/opengeospatial/geoparquet

    If 'crs' key is not present in the Feather metadata associated with the
    Parquet object, it will default to "OGC:CRS84" according to the specification.

    Requires 'pyarrow' >= 0.17.

    .. versionadded:: 0.8

    Parameters
    ----------
    path : str, path object
    columns : list-like of strings, default=None
        If not None, only these columns will be read from the file.  If
        the primary geometry column is not included, the first secondary
        geometry read from the file will be set as the geometry column
        of the returned GeoDataFrame.  If no geometry columns are present,
        a ``ValueError`` will be raised.
    to_pandas_kwargs : dict, optional
        Arguments passed to the `pa.Table.to_pandas` method for non-geometry columns.
        This can be used to control the behavior of the conversion of the non-geometry
        columns to a pandas DataFrame. For example, you can use this to control the
        dtype conversion of the columns. By default, the `to_pandas` method is called
        with no additional arguments.
    **kwargs
        Any additional kwargs passed to pyarrow.feather.read_table().

    Returns
    -------
    GeoDataFrame

    Examples
    --------
    >>> df = geopandas.read_feather("data.feather")  # doctest: +SKIP

    Specifying columns to read:

    >>> df = geopandas.read_feather(
    ...     "data.feather",
    ...     columns=["geometry", "pop_est"]
    ... )  # doctest: +SKIP
    r   r   r   r   Nr[   )r   )r	   r   r   r   r   )r   r[   r   r   r   rW   r   s          r   _read_featherr    sN    r )!KG (DGt?W??Eu7GHHr    c                 \   | d   }t        |       rt        |       }t        ||      S | d   |   d   dk(  rmdd lm} |j                  |df      |d   k\  |j                  |df      |d   k  z  |j                  |df      |d	   k\  z  |j                  |df      |d
   k  z  S t        d      )NrZ   r[   rJ   r   r   x   yr   r   z}Specifying 'bbox' not supported for this Parquet file (it should either have a bbox covering column or use 'point' encoding).)r   _get_bbox_encoding_column_name_convert_bbox_to_parquet_filterpyarrow.computecomputefieldra   )r   rP   rZ   bbox_column_namepcs        r   r   r   a  s    !"23N),79,G.t5EFF	i	 	0	<	G$ XX~s+,Q7xx-.$q'9;xx-.$q'9; xx-.$q'9;	
 D
 	
r    c                     dd l m} |j                  |df      | d   kD  |j                  |df      | d   kD  z  |j                  |df      | d   k  z  |j                  |df      | d   k  z   S )	Nr   rQ   r	  rR   r   rS   rT   r   )r  r  r  )rP   r  r  s      r   r  r  y  s      
#V,	-Q	788%v./$q'9	;88%v./$q'9	; 88%v./$q'9	; r    c                 <    | d   }d| d   |   j                         v S )NrZ   rV   r[   )r   r   rZ   s     r   r   r     s+    !"23Ni0@EEGGGr    c                 4    | d   }| d   |   d   d   d   d   S )NrZ   r[   rV   rP   rQ   r   rH   r  s     r   r  r    s1    !"23N	">2:>vFvNqQQr    c                 ^    t        |      }| j                  }||v r|j                  |       |S r   )r  r   r>   )r   r   r  r[   s       r   r   r     s0    5lCllG7"'(Nr    c                 P    t        dd      }|| S |j                  |       }||z  S )Nr   r   r   )r	   filters_to_expression)kwarg_filtersr  r   filters_expressions       r   r   r     s=    (!KG  66}E+++r    )NNF)Nr   NN)Nsnappyr   NF)NNN)NN)NNNN)6rw   r   packaging.versionr   typingr   r   numpyrh   pandasr   r   r7   rW   r   geopandas._compatr	   geopandas.arrayr
   r   filer   r_   SUPPORTED_VERSIONS_LITERALr'   r`   r   r   PARQUET_GEOMETRY_ENCODINGSr   r&   r@   rE   rt   r{   r   r   r   r   r   r   r   r   r   r   r   r  r  r   r  r   r  r   r   )	geom_types   0r   <module>r&     s_     % $  $   " 8 2  $%WX (#=>?   g 22 $%67 <'&	  ;OPiT)P P I  JOWt04">6ASL 33r <H~&JRF/R>0 "H 	~FBAIH
0H
R
,k Qs   8C"