GET /datastores/{datastore_id}/datasources/{datasource_id}/mapfile: Get
            the JSON representation of a specific datasource's default MapFile LAYER
            block.

def showmapfile(self,datastore_id=None, datasource_id=None):
        """ GET /datastores/{datastore_id}/datasources/{datasource_id}/mapfile: Get
            the JSON representation of a specific datasource's default MapFile LAYER
            block. """
        datastore = self._get_datastore_by_id(datastore_id)
        if datastore is None:
            abort(404)
        classification = None
        if 'classification' in request.params and 'attribute' in request.params:
            classification = {}
            classification['type'] = request.params['classification']
            classification['attribute'] = request.params['attribute']
            if classification['type'] == "quantile":
                classification['intervals'] = request.params['intervals']
            
            palette = {}
            palette['type']='ramp'
            if 'colortype' in request.params:
                palette['type'] = request.params['colortype']
            if 'startcolor' in request.params:
                c = request.params['startcolor']
                if c.startswith('#'):
                    c = c[1:]
                palette['startcolor'] = [int(c[0:2],16),int(c[2:4],16),int(c[4:6],16)]
            if 'endcolor' in request.params:
                c = request.params['endcolor']
                if c.startswith('#'):
                    c = c[1:]
                palette['endcolor'] = [int(c[0:2],16),int(c[2:4],16),int(c[4:6],16)]
            if 'interpolation' in request.params:
                palette['interpolation'] = request.params['interpolation']
            if 'theme' in request.params:
                palette['theme'] = int(request.params['theme'])
            classification['palette'] = palette

        mapfile = get_mapfile(datastore.ogrstring, datasource_id, classification)
        if 'metadata' not in mapfile:
            mapfile['metadata']={}
        mapfile['metadata']['datastoreid']=datastore_id
        mapfile['metadata']['datasourceid']=datasource_id
        if mapfile is None:
            abort(404)
        return mapfile