'Export data as a Scalable Vector Graphic
@param resource: the source of the data that is to be encoded
as an SVG. This may be:
resource: the resource
item:     a list of pre-fetched values
the headings are in the first row
the data types are in the second row
@param attr: dictionary of parameters:
* title:          The export filename
* list_fields:    Fields to include in list views'

def encode(self, resource, **attr):

    if ((resource.prefix == 'gis') and (resource.name == 'location')):
        list_fields = ['wkt']
    else:
        list_fields = ['location_id$wkt']
    current.s3db.gis_location.wkt.represent = None
    (_title, types, lfields, headers, items) = self.extractResource(resource, list_fields)
    wkt = items[0]['gis_location.wkt']
    if (not wkt):
        current.log.error('No    Geometry!')
    title = attr.get('title', resource._ids[0])
    filename = ('%s.svg' % title)
    filepath = self.write_file(filename, wkt, **attr)
    disposition = ('attachment;    filename="%s"' % filename)
    response = current.response
    response.headers['Content-Type'] = contenttype('.svg')
    response.headers['Content-disposition'] = disposition
    stream = open(filepath)
    return response.stream(stream, chunk_size=DEFAULT_CHUNK_SIZE, request=current.request)
