a
    Df!                     @   sJ  d dl 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 G dd deZd	d
d
ddd	dddddddZdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zd d Zd!d Zd"d Zd#d Zd$d Zd%d ZeZd&d Z d'd Z!d(d) e" # D Z$d*d) e$# D Z%d+d) e$# D Z&dS ),    )FunctionTypeN   )	Dimension)	Element2D)easting_northing_to_lon_latlon_lat_to_easting_northingc                       sz   e Zd ZdZejededgddddZejd ddZ	d fd
d	Z
dddZdddZedd Zedd Z  ZS )Tilesa  
    The Tiles element represents tile sources, specified as URL
    containing different template variables or xyzservices.TileProvider.
    These variables correspond to three different formats for specifying the spatial
    location and zoom level of the requested tiles:

      * Web mapping tiles sources containing {x}, {y}, and {z} variables

      * Bounding box tile sources containing {XMIN}, {XMAX}, {YMIN}, {YMAX} variables

      * Quadkey tile sources containing a {Q} variable

    Tiles are defined in a pseudo-Mercator projection (EPSG:3857)
    defined as eastings and northings. Any data overlaid on a tile
    source therefore has to be defined in those coordinates or be
    projected (e.g. using GeoViews).
    xy)r   r   Tzd
        The key dimensions of a geometry represent the x- and y-
        coordinates in a 2D space.)defaultZboundsconstantdoc)r   r   Nc                    sr   ddl m} t||r|j}n6|d urTt|ttfsTtt| j dt|j dt	 j
|f||d| d S )Nr   )MercatorTileSourcezE data should be a tile service URL or xyzservices.TileProvider not a z type.)kdimsvdims)Zbokeh.modelsr   
isinstanceurlstrdict	TypeErrortype__name__super__init__)selfdatar   r   paramsr   	__class__ d/nfs/NAS7/SABIOD/METHODE/ermites/ermites_venv/lib/python3.9/site-packages/holoviews/element/tiles.pyr   %   s    

zTiles.__init__c                 C   s   t jt jfS N)npnan)r   ZdimZ
data_rangeZdimension_ranger   r   r    range.   s    zTiles.rangec                 C   s
   t g S r!   )r"   array)r   Z	dimensionexpandedZflatr   r   r    dimension_values1   s    zTiles.dimension_valuesc                 C   s
   t | |S )z
        Projects the given longitude, latitude values into Web Mercator
        (aka Pseudo-Mercator or EPSG:3857) coordinates.

        See docstring for holoviews.util.transform.lon_lat_to_easting_northing
        for more information
        )r   )Z	longitudeZlatituder   r   r    r   4   s    	z!Tiles.lon_lat_to_easting_northingc                 C   s
   t | |S )z
        Projects the given easting, northing values into
        longitude, latitude coordinates.

        See docstring for holoviews.util.transform.easting_northing_to_lon_lat
        for more information
        )r   )ZeastingZnorthingr   r   r    r   ?   s    	z!Tiles.easting_northing_to_lon_lat)NNN)TT)TT)r   
__module____qualname____doc__paramListr   r   Stringgroupr   r$   r'   staticmethodr   r   __classcell__r   r   r   r    r      s   	



r   zW&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributorsz&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="https://cartodb.com/attributions">CartoDB</a>a;  Map tiles by <a href="https://stamen.com">Stamen Design</a> / <a href="https://stadiamaps.com">Stadia Maps</a>, under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, under <a href="https://www.openstreetmap.org/copyright">ODbL</a>.aF  Map tiles by <a href="https://stamen.com">Stamen Design</a> / <a href="https://stadiamaps.com">Stadia Maps</a>, under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, under <a href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.za&copy; <a href="http://downloads.esri.com/ArcGISOnline/docs/tou_summary.pdf">Esri</a>, USGS, NOAAzh&copy; <a href="http://downloads.esri.com/ArcGISOnline/docs/tou_summary.pdf">Esri</a>, Garmin, USGS, NPSzl&copy; <a href="http://downloads.esri.com/ArcGISOnline/docs/tou_summary.pdf">Esri</a>, Earthstar Geographicsz&copy; <a href="http://downloads.esri.com/ArcGISOnline/docs/tou_summary.pdf">Esri</a>, NatGeo, Garmin, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, Increment Pzf&copy; <a href="http://downloads.esri.com/ArcGISOnline/docs/tou_summary.pdf">Esri</a>, NatGeo, i-cubedz&copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012))Zopenstreetmap)Zcartodb)Zcartocdn)stamenZpng)r1   Zjpg)Z	wikimedia)arcgisZTerrain)r2   Z	Reference)r2   ZImagery)r2   ZNatGeo)r2   ZUSA_Topo)r2   ZWorld_Street_Mapc                   C   s   t dddS )NzIhttps://cartodb-basemaps-4.global.ssl.fastly.net/dark_all/{Z}/{X}/{Y}.png	CartoDarknamer   r   r   r   r    <lambda>       r7   c                   C   s   t dddS )NzJhttps://cartodb-basemaps-4.global.ssl.fastly.net/light_all/{Z}/{X}/{Y}.png
CartoLightr4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )NzAhttps://tiles.stadiamaps.com/tiles/stamen_terrain/{Z}/{X}/{Y}.pngStamenTerrainr4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )NzDhttps://tiles.stadiamaps.com/tiles/stamen_terrain/{Z}/{X}/{Y}@2x.pngStamenTerrainRetinar4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )NzDhttps://tiles.stadiamaps.com/tiles/stamen_watercolor/{Z}/{X}/{Y}.jpgStamenWatercolorr4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )Nz?https://tiles.stadiamaps.com/tiles/stamen_toner/{Z}/{X}/{Y}.pngStamenTonerr4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )NzBhttps://tiles.stadiamaps.com/tiles/stamen_toner/{Z}/{X}/{Y}@2x.pngStamenTonerRetinar4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )NzJhttps://tiles.stadiamaps.com/tiles/stamen_toner_background/{Z}/{X}/{Y}.pngStamenTonerBackgroundr4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )NzMhttps://tiles.stadiamaps.com/tiles/stamen_toner_background/{Z}/{X}/{Y}@2x.pngStamenTonerBackgroundRetinar4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )NzFhttps://tiles.stadiamaps.com/tiles/stamen_toner_labels/{Z}/{X}/{Y}.pngStamenLabelsr4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )NzIhttps://tiles.stadiamaps.com/tiles/stamen_toner_labels/{Z}/{X}/{Y}@2x.pngStamenLabelsRetinar4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )Nzahttps://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{Z}/{Y}/{X}.jpgEsriImageryr4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )Nz`https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{Z}/{Y}/{X}
EsriNatGeor4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )Nz]https://server.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{Z}/{Y}/{X}EsriUSATopor4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )Nzbhttps://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{Z}/{Y}/{X}EsriTerrainr4   r6   r   r   r   r    r7      r8   c                   C   s   t dS )Nz`https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{Z}/{Y}/{X}r6   r   r   r   r    r7      r8   c                   C   s   t dddS )Nzqhttps://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{Z}/{Y}/{X}EsriReferencer4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )Nz0https://c.tile.openstreetmap.org/{Z}/{X}/{Y}.pngOSMr4   r6   r   r   r   r    r7      r8   c                   C   s   t dddS )Nz.https://a.tile.opentopomap.org/{Z}/{X}/{Y}.pngOpenTopoMapr4   r6   r   r   r   r    r7      r8   c                 C   s(   i | ] \}}t |tr|d vr||qS ))ESRIr   r   Zdeprecation_warningZwikimedia_replacement)r   r   .0kvr   r   r    
<dictcomp>   s   rO   c                 C   s   i | ]\}}d |vr||qS ZStamenr   rK   r   r   r    rO      r8   c                 C   s   i | ]\}}d |v r||qS rP   r   rK   r   r   r    rO      r8   )'typesr   numpyr"   r+   Zcore.dimensionr   Zcore.elementr   Zutil.transformr   r   r   Z_ATTRIBUTIONSr3   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   Z
EsriStreetrG   rJ   rH   rI   localsitemsZ_all_tile_sourcesZtile_sourcesZstamen_sourcesr   r   r   r    <module>   sT   C6