# Path: spillway/collections.py
# def as_feature(data):
# def has_coordinates(geometry):
# def has_features(fcollection):
# def is_featurelike(feature):
# def has_layer(fcollection):
#     def __init__(self, srid=4326, iterable=(), **kwargs):
#     def __init__(self, srid=4326, iterable=(), **kwargs):
#     def __geo_interface__(self):
#     def __str__(self):
#     def _dumps(self):
#     def geojson(self):
#     def is_serialized(self, key):
#     def copy(self):
#     def srs(self):
#     def __init__(self, id=None, geometry=None, properties=None,
#                  crs=None, iterable=(), **kwargs):
#     def geojson(self):
#     def __init__(self, features=None, crs=None, iterable=(), **kwargs):
#     def geojson(self):
#     def has_serialized_geom(self):
#     def __init__(self, iterable=(), **kwargs):
#     def geojson(self):
# class LinkedCRS(dict):
# class NamedCRS(dict):
# class AbstractFeature(dict):
# class Feature(AbstractFeature):
# class FeatureCollection(AbstractFeature):
# class LayerCollection(AbstractFeature):


from django.contrib.gis.shortcuts import compress_kml
from django.template import loader
from rest_framework.renderers import BaseRenderer, JSONRenderer
from spillway import collections



class GeoJSONRenderer(JSONRenderer):
    """Renderer which serializes to GeoJSON.

    This renderer purposefully avoids reserialization of GeoJSON from the
    spatial backend which greatly improves performance.
    """
    media_type = 'application/vnd.geo+json'
    format = 'geojson'
    charset = 'utf-8'

    def render(self, data, accepted_media_type=None, renderer_context=None):
        """Returns *data* encoded as GeoJSON."""
        data = collections.as_feature(data)
        try:
            return data.geojson
        except AttributeError:
            return super(GeoJSONRenderer, self).render(
                data, accepted_media_type, renderer_context)


class TemplateRenderer(BaseRenderer):
    """Template based feature renderer."""
    template_name = None

    def render(self, data, accepted_media_type=None, renderer_context=None):

# Path: spillway/collections.py
# def as_feature(data):
# def has_coordinates(geometry):
# def has_features(fcollection):
# def is_featurelike(feature):
# def has_layer(fcollection):
#     def __init__(self, srid=4326, iterable=(), **kwargs):
#     def __init__(self, srid=4326, iterable=(), **kwargs):
#     def __geo_interface__(self):
#     def __str__(self):
#     def _dumps(self):
#     def geojson(self):
#     def is_serialized(self, key):
#     def copy(self):
#     def srs(self):
#     def __init__(self, id=None, geometry=None, properties=None,
#                  crs=None, iterable=(), **kwargs):
#     def geojson(self):
#     def __init__(self, features=None, crs=None, iterable=(), **kwargs):
#     def geojson(self):
#     def has_serialized_geom(self):
#     def __init__(self, iterable=(), **kwargs):
#     def geojson(self):
# class LinkedCRS(dict):
# class NamedCRS(dict):
# class AbstractFeature(dict):
# class Feature(AbstractFeature):
# class FeatureCollection(AbstractFeature):
# class LayerCollection(AbstractFeature):


# Path: spillway/renderers/renderers.py
from django.contrib.gis.shortcuts import compress_kml
from django.template import loader
from rest_framework.renderers import BaseRenderer, JSONRenderer
from spillway import collections




class GeoJSONRenderer(JSONRenderer):
    """Renderer which serializes to GeoJSON.

    This renderer purposefully avoids reserialization of GeoJSON from the
    spatial backend which greatly improves performance.
    """
    media_type = 'application/vnd.geo+json'
    format = 'geojson'
    charset = 'utf-8'

    def render(self, data, accepted_media_type=None, renderer_context=None):
        """Returns *data* encoded as GeoJSON."""
        data = collections.as_feature(data)
        try:
            return data.geojson
        except AttributeError:
            return super(GeoJSONRenderer, self).render(
                data, accepted_media_type, renderer_context)


class TemplateRenderer(BaseRenderer):
    """Template based feature renderer."""
    template_name = None

    def render(self, data, accepted_media_type=None, renderer_context=None):

        collection = collections.as_feature(data)