
    Dh8                         S r SSKJrJrJrJr  SSKrSSKJr  SSK	J
r
  SSKJrJrJrJrJrJrJrJr   " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      rg)zX
Wraps leaflet TileLayer, WmsTileLayer (TileLayer.WMS), ImageOverlay, and VideoOverlay

    )AnyCallableOptionalUnionN)Layer)Template)
TypeBoundsTypeBoundsReturnTypeJsonValueimage_to_urlmercator_transformnormalize_bounds_typeparse_optionsremove_emptyc                      ^  \ rS rSrSr\" S5      r              SS\\\	R                  4   S\\   S\\   S\\   S\\   S	\S
\\   S\S\S\S\S\S\S\4U 4S jjjrSrU =r$ )	TileLayer   at	  
Create a tile layer to append on a Map.

Parameters
----------
tiles: str or :class:`xyzservices.TileProvider`, default 'OpenStreetMap'
    Map tileset to use. Folium has built-in all tilesets
    available in the ``xyzservices`` package. For example, you can pass
    any of the following to the "tiles" keyword:

        - "OpenStreetMap"
        - "CartoDB Positron"
        - "CartoDB Voyager"

    Explore more provider names available in ``xyzservices`` here:
    https://leaflet-extras.github.io/leaflet-providers/preview/.

    You can also pass a custom tileset by passing a
    :class:`xyzservices.TileProvider` or a Leaflet-style
    URL to the tiles parameter: ``https://{s}.yourtiles.com/{z}/{x}/{y}.png``.
min_zoom: int, optional, default 0
    Minimum allowed zoom level for this tile layer. Filled by xyzservices by default.
max_zoom: int, optional, default 18
    Maximum allowed zoom level for this tile layer. Filled by xyzservices by default.
max_native_zoom: int, default None
    The highest zoom level at which the tile server can provide tiles.
    Filled by xyzservices by default.
    By setting max_zoom higher than max_native_zoom, you can zoom in
    past max_native_zoom, tiles will be autoscaled.
attr: string, default None
    Map tile attribution; only required if passing custom tile URL.
detect_retina: bool, default False
    If true and user is on a retina display, it will request four
    tiles of half the specified size and a bigger zoom level in place
    of one to utilize the high resolution.
name : string, default None
    The name of the Layer, as it will appear in LayerControls
overlay : bool, default False
    Adds the layer as an optional overlay (True) or the base layer (False).
control : bool, default True
    Whether the Layer will be included in LayerControls.
show: bool, default True
    Whether the layer will be shown on opening.
    When adding multiple base layers, use this parameter to select which one
    should be shown when opening the map, by not showing the others.
subdomains: list of strings, default ['abc']
    Subdomains of the tile service.
tms: bool, default False
    If true, inverses Y axis numbering for tiles (turn this on for TMS
    services).
opacity: float, default 1
    Sets the opacity for the layer.
**kwargs : additional keyword arguments
    Other keyword arguments are passed as options to the Leaflet tileLayer
    object.
z
        {% macro script(this, kwargs) %}
            var {{ this.get_name() }} = L.tileLayer(
                {{ this.tiles|tojson }},
                {{ this.options|tojavascript }}

            );
        {% endmacro %}
        tilesmin_zoommax_zoommax_native_zoomattrdetect_retinanameoverlaycontrolshowno_wrap
subdomainstmsopacityc                   > [        U[        5      (       a;  UR                  5       S:X  a  SnUc  Sn [        R                  R                  U5      n[        U[        R                  5      (       a  U(       a  UOUR                  nU=(       d    UR                  S5      nU=(       d    UR                  S5      nUR                  SU5      nUc*  UR                  R                  SS5      R                  5       nUR                  SS	S
9nUb  UO:SR                  UR                  5       R                  5       R                  5       5      U l        ["        TU ]I  U R                   XU
S9  SU l        Xl        U(       d  [        S5      e[+        SU=(       d    SU=(       d    SU=(       d    U=(       d    SUUUUUUS.	UD6U l        g ! [         a     GNf = f)NopenstreetmapzOpenStreetMap Mapnikr   r   r   . Fz{r})fill_subdomainscale_factorr   r   r   r   r   z&Custom tiles must have an attribution.r      )	r   r   r   r   attributionr   r   r    r!    )
isinstancestrlowerxyzservices	providers
query_name
ValueErrorTileProviderhtml_attributiongetr   replace	build_urljoinstripsplit	tile_namesuper__init___namer   r   options)selfr   r   r   r   r   r   r   r   r   r   r   r   r    r!   kwargs	__class__s                   gC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\folium/raster_layers.pyr=   TileLayer.__init__^   s   $ eS!!{{}/.<*D#--88?
 e[55664U%;%;D8599Z#8H8599Z#8H<<J|zz))#r288:OO5uOME $D"''%++-2E2E2G2M2M2O*P 	 	 	 	
 !

EFF# 
]^+=x=2!'
 
3  s   G 
GG)r>   r?   r;   r   )OpenStreetMapNNNNFNFTTFabcF   )__name__
__module____qualname____firstlineno____doc__r   	_templater   r-   r/   r3   r   intboolfloatr=   __static_attributes____classcell__rB   s   @rC   r   r      s    7r 	
I 7F"&"&)-"#"=
S+2223=
 3-=
 3-	=

 "#=
 sm=
 =
 sm=
 =
 =
 =
 =
 =
 =
 =
 =
    r   c                      ^  \ rS rSrSr\" S5      r         SS\S\S\S\S\S	\S
\S\	\   S\S\S\4U 4S jjjr
SrU =r$ )WmsTileLayer   a  
Creates a Web Map Service (WMS) layer.

Parameters
----------
url : str
    The url of the WMS server.
layers : str
    Comma-separated list of WMS layers to show.
styles : str, optional
    Comma-separated list of WMS styles.
fmt : str, default 'image/jpeg'
    The format of the service output. Ex: 'image/png'
transparent: bool, default False
    Whether the layer shall allow transparency.
version : str, default '1.1.1'
    Version of the WMS service to use.
attr : str, default ''
    The attribution of the service.
    Will be displayed in the bottom right corner.
name : string, optional
    The name of the Layer, as it will appear in LayerControls
overlay : bool, default True
    Adds the layer as an optional overlay (True) or the base layer (False).
control : bool, default True
    Whether the Layer will be included in LayerControls.
show: bool, default True
    Whether the layer will be shown on opening.
**kwargs : additional keyword arguments
    Passed through to the underlying tileLayer.wms object and can be used
    for setting extra tileLayer.wms parameters or as extra parameters in
    the WMS request.

See https://leafletjs.com/reference.html#tilelayer-wms
z
        {% macro script(this, kwargs) %}
            var {{ this.get_name() }} = L.tileLayer.wms(
                {{ this.url|tojson }},
                {{ this.options|tojson }}
            );
        {% endmacro %}
        urllayersstylesfmttransparentversionr   r   r   r   r   c           	         > [         TU ]  XXS9  Xl        XLS'   UR                  SS 5      n[	        SUUUUUS.UD6U l        U(       a  XR
                  S'   g g )Nr(   format
cql_filter)rY   rZ   r\   r]   r*   r+   )r<   r=   rX   popr   r?   )r@   rX   rY   rZ   r[   r\   r]   r   r   r   r   r   rA   r`   rB   s                 rC   r=   WmsTileLayer.__init__   st     	dWPxZZd3
$ 
#
 
 )3LL& rT   )r?   rX   )	r%   z
image/jpegFz1.1.1r%   NTTT)rH   rI   rJ   rK   rL   r   rM   r-   rO   r   r=   rQ   rR   rS   s   @rC   rV   rV      s    "H 		I !"44 4 	4
 4 4 4 4 sm4 4 4 4 4rT   rV   c                      ^  \ rS rSrSr\" S5      r        SS\S\S\	S\
\   S\S	\S
\
\	   S\S\S\4U 4S jjjrS\4S jrSrU =r$ )ImageOverlay   a  
Used to load and display a single image over specific bounds of
the map, implements ILayer interface.

Parameters
----------
image: string or array-like object
    The data to overlay as an image.

    * If string is a path to an image file, its content will be converted and
      embedded.
    * If string is a URL, it will be linked.
    * Otherwise a string will be assumed to be JSON and embedded.
    * If array-like, it will be converted to PNG base64 string and embedded.
bounds: list/tuple of list/tuple of float
    Image bounds on the map in the form
    [[lat_min, lon_min], [lat_max, lon_max]]
opacity: float, default Leaflet's default (1.0)
alt: string, default Leaflet's default ('')
origin: ['upper' | 'lower'], optional, default 'upper'
    Place the [0,0] index of the array in the upper left or
    lower left corner of the axes.
colormap: callable, used only for `mono` image.
    Function of the form [x -> (r,g,b)] or [x -> (r,g,b,a)]
    for transforming a mono image into RGB.
    It must output iterables of length 3 or 4,
    with values between 0 and 1.
    Hint: you can use colormaps from `matplotlib.cm`.
mercator_project: bool, default False.
    Used only for array-like image.  Transforms the data to
    project (longitude, latitude) coordinates to the Mercator projection.
    Beware that this will only work if `image` is an array-like object.
    Note that if used the image will be clipped beyond latitude -85 and 85.
pixelated: bool, default True
    Sharp sharp/crips (True) or aliased corners (False).
name : string, default None
    The name of the Layer, as it will appear in LayerControls
overlay : bool, default True
    Adds the layer as an optional overlay (True) or the base layer (False).
control : bool, default True
    Whether the Layer will be included in LayerControls.
show: bool, default True
    Whether the layer will be shown on opening.

See https://leafletjs.com/reference.html#imageoverlay for more
options.

a  
        {% macro header(this, kwargs) %}
            {% if this.pixelated %}
                <style>
                    .leaflet-image-layer {
                        /* old android/safari*/
                        image-rendering: -webkit-optimize-contrast;
                        image-rendering: crisp-edges; /* safari */
                        image-rendering: pixelated; /* chrome */
                        image-rendering: -moz-crisp-edges; /* firefox */
                        image-rendering: -o-crisp-edges; /* opera */
                        -ms-interpolation-mode: nearest-neighbor; /* ie */
                    }
                </style>
            {% endif %}
        {% endmacro %}

        {% macro script(this, kwargs) %}
            var {{ this.get_name() }} = L.imageOverlay(
                {{ this.url|tojson }},
                {{ this.bounds|tojson }},
                {{ this.options|tojavascript }}
            );
        {% endmacro %}
        imageboundsorigincolormapmercator_project	pixelatedr   r   r   r   c                    > [         TU ]  XxXS9  SU l        X l        [	        S0 UD6U l        X`l        U(       a  [        XS   S   US   S   4US9n[        XUS9U l	        g )Nr(   rd   r   rG   )rh   )rh   ri   r+   )
r<   r=   r>   rg   r   r?   rk   r   r   rX   )r@   rf   rg   rh   ri   rj   rk   r   r   r   r   rA   rB   s               rC   r=   ImageOverlay.__init__<  sn     	dWP#
#-f-"&q	!fQil3FE  xHrT   returnc                 ,    [        U R                  5      $ )z
Computes the bounds of the object itself (not including it's children)
in the form [[lat_min, lon_min], [lat_max, lon_max]].

r   rg   r@   s    rC   _get_self_boundsImageOverlay._get_self_boundsV       %T[[11rT   )r>   rg   r?   rk   rX   )upperNFTNTTT)rH   rI   rJ   rK   rL   r   rM   r   r	   r-   r   r   rO   r=   r
   rr   rQ   rR   rS   s   @rC   rd   rd      s    /b 	I@ '+!&"II I 	I
 8$I I I smI I I I I42"2 2 2rT   rd   c                      ^  \ rS rSrSr\" S5      r      SS\S\S\	S\	S\
\   S	\	S
\	S\	S\4U 4S jjjrS\4S jrSrU =r$ )VideoOverlayi_  a  
Used to load and display a video over the map.

Parameters
----------
video_url: str
    URL of the video
bounds: list/tuple of list/tuple of float
    Video bounds on the map in the form
     [[lat_min, lon_min], [lat_max, lon_max]]
autoplay: bool, default True
loop: bool, default True
name : string, default None
    The name of the Layer, as it will appear in LayerControls
overlay : bool, default True
    Adds the layer as an optional overlay (True) or the base layer (False).
control : bool, default True
    Whether the Layer will be included in LayerControls.
show: bool, default True
    Whether the layer will be shown on opening.
**kwargs:
    Other valid (possibly inherited) options. See:
    https://leafletjs.com/reference.html#videooverlay

a  
        {% macro script(this, kwargs) %}
            var {{ this.get_name() }} = L.videoOverlay(
                {{ this.video_url|tojson }},
                {{ this.bounds|tojson }},
                {{ this.options|tojavascript }}
            );
        {% endmacro %}
        	video_urlrg   autoplayloopr   r   r   r   rA   c	                 l   > [         T
U ]  XVXxS9  SU l        Xl        X l        [        SX4S.U	D6U l        g )Nr(   rw   )ry   rz   r+   )r<   r=   r>   rx   rg   r   r?   )r@   rx   rg   ry   rz   r   r   r   r   rA   rB   s             rC   r=   VideoOverlay.__init__  s<     	dWP#
"#KXKFKrT   rn   c                 ,    [        U R                  5      $ )z~
Computes the bounds of the object itself (not including it's children)
in the form [[lat_min, lon_min], [lat_max, lon_max]]

rp   rq   s    rC   rr   VideoOverlay._get_self_bounds  rt   rT   )r>   rg   r?   rx   )TTNTTT)rH   rI   rJ   rK   rL   r   rM   r-   r	   rO   r   r   r=   r
   rr   rQ   rR   rS   s   @rC   rw   rw   _  s    4 	
I  "LL L 	L
 L smL L L L  L L&2"2 2 2rT   rw   )rL   typingr   r   r   r   r/   
folium.mapr   folium.templater   folium.utilitiesr	   r
   r   r   r   r   r   r   r   rV   rd   rw   r+   rT   rC   <module>r      se   
 2 1   $	 	 	C
 C
LM45 M4`n25 n2b@25 @2rT   