# Path: TileStache/Core.py
# class KnownUnknown(Exception):
#     """ There are known unknowns. That is to say, there are things that we now know we don't know.
# 
#         This exception gets thrown in a couple places where common mistakes are made.
#     """
#     pass
# 
# Path: TileStache/py3_compat.py
# def is_string_type(val):


from operator import add
from ..Core import KnownUnknown
from ..py3_compat import reduce
        self.rings = rings
        self.spatialReference = sref
        dict.__init__(self, {'spatialReference': sref, 'rings': rings})

pyamf_classes = {
    _amfFeatureSet: 'com.esri.ags.tasks.FeatureSet',
    _amfSpatialReference: 'com.esri.ags.SpatialReference',
    _amfGeometryMapPoint: 'com.esri.ags.geometry.MapPoint',
    _amfGeometryPolyline: 'com.esri.ags.geometry.Polyline',
    _amfGeometryPolygon: 'com.esri.ags.geometry.Polygon',
    _amfFeature: 'com.esri.ags.Feature'
  }

def reserialize_to_arc(content, point_objects):
    """ Convert from "geo" (GeoJSON) to ESRI's GeoServices REST serialization.

        Second argument is a boolean flag for whether to use the class
        _amfGeometryMapPoint for points in ring and path arrays, or tuples.
        The formal class is needed for AMF responses, plain tuples otherwise.

        Much of this cribbed from sample server queries and page 191+ of:
          http://www.esri.com/library/whitepapers/pdfs/geoservices-rest-spec.pdf
    """
    mapPointList = point_objects and _amfGeometryMapPoint or (lambda s, x, y: (x, y))
    mapPointDict = point_objects and _amfGeometryMapPoint or (lambda s, x, y: {'x': x, 'y': y})

    found_geometry_types = set([feat['geometry']['type'] for feat in content['features']])
    found_geometry_types = set([geometry_types.get(type) for type in found_geometry_types])

    if len(found_geometry_types) > 1:

# Path: TileStache/Core.py
# class KnownUnknown(Exception):
#     """ There are known unknowns. That is to say, there are things that we now know we don't know.
# 
#         This exception gets thrown in a couple places where common mistakes are made.
#     """
#     pass
# 
# Path: TileStache/py3_compat.py
# def is_string_type(val):


# Path: TileStache/Vector/Arc.py
from operator import add
from ..Core import KnownUnknown
from ..py3_compat import reduce

        self.rings = rings
        self.spatialReference = sref
        dict.__init__(self, {'spatialReference': sref, 'rings': rings})

pyamf_classes = {
    _amfFeatureSet: 'com.esri.ags.tasks.FeatureSet',
    _amfSpatialReference: 'com.esri.ags.SpatialReference',
    _amfGeometryMapPoint: 'com.esri.ags.geometry.MapPoint',
    _amfGeometryPolyline: 'com.esri.ags.geometry.Polyline',
    _amfGeometryPolygon: 'com.esri.ags.geometry.Polygon',
    _amfFeature: 'com.esri.ags.Feature'
  }

def reserialize_to_arc(content, point_objects):
    """ Convert from "geo" (GeoJSON) to ESRI's GeoServices REST serialization.

        Second argument is a boolean flag for whether to use the class
        _amfGeometryMapPoint for points in ring and path arrays, or tuples.
        The formal class is needed for AMF responses, plain tuples otherwise.

        Much of this cribbed from sample server queries and page 191+ of:
          http://www.esri.com/library/whitepapers/pdfs/geoservices-rest-spec.pdf
    """
    mapPointList = point_objects and _amfGeometryMapPoint or (lambda s, x, y: (x, y))
    mapPointDict = point_objects and _amfGeometryMapPoint or (lambda s, x, y: {'x': x, 'y': y})

    found_geometry_types = set([feat['geometry']['type'] for feat in content['features']])
    found_geometry_types = set([geometry_types.get(type) for type in found_geometry_types])

    if len(found_geometry_types) > 1:

        raise KnownUnknown('Arc serialization needs a single geometry type, not ' + ', '.join(found_geometry_types))