'Returns a Marker dict
- called by xml.gis_encode() for non-geojson resources
- called by S3Map.widget() if no marker_fn supplied'

@staticmethod
def get_marker(controller=None, function=None, filter=None):

    marker = None
    if (controller and function):
        db = current.db
        s3db = current.s3db
        ftable = s3db.gis_layer_feature
        stable = s3db.gis_style
        mtable = s3db.gis_marker
        config = GIS.get_config()
        query = (((ftable.controller == controller) & (ftable.function == function)) & (ftable.aggregate == False))
        left = (stable.on((((stable.layer_id == ftable.layer_id) & (stable.record_id == None)) & ((stable.config_id == config.id) | (stable.config_id == None)))), mtable.on((mtable.id == stable.marker_id)))
        if filter:
            query &= (ftable.filter == filter)
        if (current.deployment_settings.get_database_type() == 'postgres'):
            orderby = stable.config_id
        else:
            orderby = (~ stable.config_id)
        layers = db(query).select(mtable.image, mtable.height, mtable.width, ftable.style_default, stable.gps_marker, left=left, orderby=orderby)
        if (len(layers) > 1):
            layers.exclude((lambda row: (row['gis_layer_feature.style_default'] == False)))
        if (len(layers) == 1):
            layer = layers.first()
        else:
            layer = None
        if layer:
            _marker = layer['gis_marker']
            if _marker.image:
                marker = dict(image=_marker.image, height=_marker.height, width=_marker.width, gps_marker=layer['gis_style'].gps_marker)
    if (not marker):
        marker = Marker().as_dict()
    return marker
