
    Ch                     Z    S SK r S SKJr  S SKrS SKJr  S SKrS rS	S jr	S	S jr
S rS rg)
    N)defaultdict)Pointc                 @    SSK nXR                  R                  :X  a  gg)z
Amount of time to wait between requests to a geocoding API, for providers
that specify rate limits in their terms of service.
r   N   )geopy.geocoders	geocoders	Nominatim)providergeopys     lC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\geopandas/tools/geocoding.py_get_throttle_timer      s    
  ??,,,    c                 >    Uc  Sn[        U5      n[        U SX40 UD6$ )a  
Geocode a set of strings and get a GeoDataFrame of the resulting points.

Parameters
----------
strings : list or Series of addresses to geocode
provider : str or geopy.geocoder
    Specifies geocoding service to use. If none is provided,
    will use 'photon' (see the Photon's terms of service at:
    https://photon.komoot.io).

    Either the string name used by geopy (as specified in
    geopy.geocoders.SERVICE_TO_GEOCODER) or a geopy Geocoder instance
    (e.g., geopy.geocoders.Photon) may be used.

    Some providers require additional arguments such as access keys
    See each geocoder's specific parameters in geopy.geocoders

Notes
-----
Ensure proper use of the results by consulting the Terms of Service for
your provider.

Geocoding requires geopy. Install it using 'pip install geopy'. See also
https://github.com/geopy/geopy

Examples
--------
>>> df = geopandas.tools.geocode(  # doctest: +SKIP
...         ["boston, ma", "1600 pennsylvania ave. washington, dc"]
...     )
>>> df  # doctest: +SKIP
                    geometry                                            address
0  POINT (-71.05863 42.35899)                          Boston, MA, United States
1  POINT (-77.03651 38.89766)  1600 Pennsylvania Ave NW, Washington, DC 20006...
photonTr   _query)stringsr
   kwargsthrottle_times       r   geocoder      s.    J &x0M'4CFCCr   c                 >    Uc  Sn[        U5      n[        U SX40 UD6$ )a  
Reverse geocode a set of points and get a GeoDataFrame of the resulting
addresses.

The points

Parameters
----------
points : list or Series of Shapely Point objects.
    x coordinate is longitude
    y coordinate is latitude
provider : str or geopy.geocoder (opt)
    Specifies geocoding service to use. If none is provided,
    will use 'photon' (see the Photon's terms of service at:
    https://photon.komoot.io).

    Either the string name used by geopy (as specified in
    geopy.geocoders.SERVICE_TO_GEOCODER) or a geopy Geocoder instance
    (e.g., geopy.geocoders.Photon) may be used.

    Some providers require additional arguments such as access keys
    See each geocoder's specific parameters in geopy.geocoders

Notes
-----
Ensure proper use of the results by consulting the Terms of Service for
your provider.

Reverse geocoding requires geopy. Install it using 'pip install geopy'.
See also https://github.com/geopy/geopy

Examples
--------
>>> from shapely.geometry import Point
>>> df = geopandas.tools.reverse_geocode(  # doctest: +SKIP
...     [Point(-71.0594869, 42.3584697), Point(-77.0365305, 38.8977332)]
... )
>>> df  # doctest: +SKIP
                     geometry                                            address
0  POINT (-71.05941 42.35837)       29 Court Sq, Boston, MA 02108, United States
1  POINT (-77.03641 38.89766)  1600 Pennsylvania Ave NW, Washington, DC 20006...
r   Fr   )pointsr
   r   r   s       r   reverse_geocoder   E   s.    V &x0M&%CFCCr   c                 z   SSK Jn  SSKJn  U(       a6  [	        U [
        R                  5      (       d  [
        R                  " U 5      n O5[	        U [        R                  5      (       d  [        R                  " U 5      n [	        U[        5      (       a  U" U5      nU" S0 UD6n0 nU R                  5        H`  u  p U(       a  UR                  U
5      X'   O)UR                  U
R                  U
R                  4SS9X'    [         R"                  " U5        Mb     [%        U5      nU$ ! U[        4 a    SX'    N9f = f)Nr   )get_geocoder_for_service)GeocoderQueryErrorT)exactly_one)NN )r   r   geopy.geocoders.baser   
isinstancepdSeries	geopandas	GeoSeriesstritemsr   reverseyx
ValueErrortimesleep_prepare_geocode_result)dataforwardr
   r   r   r   r   coderresultsisdfs               r   r   r   w   s    87$		**99T?D$	 3 344&&t,D(C  +H5vEG

	&"]]1-
"]]ACC:4]H
 	

=!  
!	)BI #J/ 	&%GJ	&s   <D'(D''D:9D:c                 ^   [        [        5      n/ nU R                  5        Hr  u  p4Uc  [        5       nSnO$Uu  pgUc  [        5       nO[        US   US   5      nUS   R	                  U5        US   R	                  U5        UR	                  U5        Mt     [
        R                  " XSS9nU$ )zConvert the geocode results to a GeoDataFrame.

Takes a dict where keys are index entries, values are tuples containing:
(address, (lat, lon))

Nr   r   geometryaddressz	EPSG:4326)indexcrs)r   listr&   r   appendr#   GeoDataFrame)	r1   dr8   r2   r3   pr7   locr4   s	            r   r-   r-      s     	DAE9AG LG {G#a&#a&)	*Q	)G$Q!  $ 
		K	@BIr   )N)r+   collectionsr   pandasr!   shapely.geometryr   r#   r   r   r   r   r-   r   r   r   <module>rC      s1     #  " )DX/Dd>r   