# Path: gbdxtools/vector_layers.py
# class VectorGeojsonLayer(VectorLayer):
#     """ Represents a vector layer created from a geojson source
# 
#         Args:
#             geojson (dict): a list of geojson features to render
#             styles (list): A list of style objects to be applied to the layer
#     """
#     def __init__(self, geojson, **kwargs):
#         super(VectorGeojsonLayer, self).__init__(**kwargs)
#         self.geojson = geojson
# 
#     def _datasource_def(self):
#         return {'type': 'geojson', 'data': self.geojson}
# 
#     def _layer_def(self, style):
#         return {
#             'id': type(style).__name__, # TODO - make this unique in the various styles
#             'type': style.type,
#             'source': self.source_id,
#             'paint': style.paint()
#         }
# 
# class VectorTileLayer(VectorLayer):
#     """ Represents a vector tile layer in a tile map
# 
#         Args:
#             url (str): a vector tile url template
#             source_name (str): the name of the source layer in the vector tiles
#             styles (list): A list of style objects to be applied to the layer
#     """
#     def __init__(self, url=None, source_layer_name='GBDX_Task_Output', **kwargs):
#         super(VectorTileLayer, self).__init__(**kwargs)
#         self.url = url
#         self.source_layer_name = source_layer_name
# 
#     def _datasource_def(self):
#         return {'type': 'vector', 'tiles': [self.url]}
# 
#     def _layer_def(self, style):
#         return {
#             'id': type(style).__name__, # TODO - make this unique in the various styles
#             'type': style.type,
#             'source': self.source_id,
#             'source-layer':  self.source_layer_name,
#             'paint': style.paint()
#         }
# 
# class ImageLayer(object):
#     """ A layer for rendering images and image arrays to slippy maps
# 
#         Args:
#             image (str): a vector tile url template
#             coordinates: the coordinate bounds (list of polygon corners) for placing the image
# 
#         Returns:
#             An string of the layer definition
#     """
#     def __new__(self, image, coordinates):
#         return json.dumps({
#             "id": uuid.uuid4().hex,
#             "type": "raster",
#             "source": {
#                 "type": "image",
#                 "url": image,
#                 "coordinates": coordinates
#             }
#         })
# 
# Path: gbdxtools/auth.py
# def Auth(**kwargs):
#     global auth
#     if auth is None or len(kwargs) > 0:
#         auth = _Auth(**kwargs)
#     return auth


from string import Template
from imageio import imsave
from io import BytesIO
from shapely.wkt import loads as load_wkt
from collections import OrderedDict
from shapely.ops import cascaded_union
from shapely.geometry import shape, box, mapping
from gbdxtools.vector_layers import VectorGeojsonLayer, VectorTileLayer, \
                                    ImageLayer
from gbdxtools.map_templates import BaseTemplate
from gbdxtools.auth import Auth
            from IPython.display import display
            from IPython.display import display
import base64
import dask.array as da
import requests
import json, time, os
"""
GBDX Vector Services Interface.

Contact: nate.ricklin@digitalglobe.com
"""







class Vectors(object):
    default_index = 'vector-gbdx-alpha-catalog-v2-*'

    def __init__(self, **kwargs):
        ''' Construct the Vectors interface class

        Returns:
            An instance of the Vectors interface class.
        '''

# Path: gbdxtools/vector_layers.py
# class VectorGeojsonLayer(VectorLayer):
#     """ Represents a vector layer created from a geojson source
# 
#         Args:
#             geojson (dict): a list of geojson features to render
#             styles (list): A list of style objects to be applied to the layer
#     """
#     def __init__(self, geojson, **kwargs):
#         super(VectorGeojsonLayer, self).__init__(**kwargs)
#         self.geojson = geojson
# 
#     def _datasource_def(self):
#         return {'type': 'geojson', 'data': self.geojson}
# 
#     def _layer_def(self, style):
#         return {
#             'id': type(style).__name__, # TODO - make this unique in the various styles
#             'type': style.type,
#             'source': self.source_id,
#             'paint': style.paint()
#         }
# 
# class VectorTileLayer(VectorLayer):
#     """ Represents a vector tile layer in a tile map
# 
#         Args:
#             url (str): a vector tile url template
#             source_name (str): the name of the source layer in the vector tiles
#             styles (list): A list of style objects to be applied to the layer
#     """
#     def __init__(self, url=None, source_layer_name='GBDX_Task_Output', **kwargs):
#         super(VectorTileLayer, self).__init__(**kwargs)
#         self.url = url
#         self.source_layer_name = source_layer_name
# 
#     def _datasource_def(self):
#         return {'type': 'vector', 'tiles': [self.url]}
# 
#     def _layer_def(self, style):
#         return {
#             'id': type(style).__name__, # TODO - make this unique in the various styles
#             'type': style.type,
#             'source': self.source_id,
#             'source-layer':  self.source_layer_name,
#             'paint': style.paint()
#         }
# 
# class ImageLayer(object):
#     """ A layer for rendering images and image arrays to slippy maps
# 
#         Args:
#             image (str): a vector tile url template
#             coordinates: the coordinate bounds (list of polygon corners) for placing the image
# 
#         Returns:
#             An string of the layer definition
#     """
#     def __new__(self, image, coordinates):
#         return json.dumps({
#             "id": uuid.uuid4().hex,
#             "type": "raster",
#             "source": {
#                 "type": "image",
#                 "url": image,
#                 "coordinates": coordinates
#             }
#         })
# 
# Path: gbdxtools/auth.py
# def Auth(**kwargs):
#     global auth
#     if auth is None or len(kwargs) > 0:
#         auth = _Auth(**kwargs)
#     return auth


# Path: gbdxtools/vectors.py
from string import Template
from imageio import imsave
from io import BytesIO
from shapely.wkt import loads as load_wkt
from collections import OrderedDict
from shapely.ops import cascaded_union
from shapely.geometry import shape, box, mapping
from gbdxtools.vector_layers import VectorGeojsonLayer, VectorTileLayer, \
                                    ImageLayer
from gbdxtools.map_templates import BaseTemplate
from gbdxtools.auth import Auth
            from IPython.display import display
            from IPython.display import display
import base64
import dask.array as da
import requests
import json, time, os

"""
GBDX Vector Services Interface.

Contact: nate.ricklin@digitalglobe.com
"""







class Vectors(object):
    default_index = 'vector-gbdx-alpha-catalog-v2-*'

    def __init__(self, **kwargs):
        ''' Construct the Vectors interface class

        Returns:
            An instance of the Vectors interface class.
        '''

        interface = Auth(**kwargs)