#NEWLINE# def kml_export_data( id_string , user ) : #NEWLINE# #INDENT# from onadata.apps.viewer.models.data_dictionary import DataDictionary #NEWLINE# dd = DataDictionary . objects . get ( id_string = id_string , user = user ) #NEWLINE# instances = Instance . objects . filter ( xform__user = user , xform__id_string = id_string , deleted_at = None , geom__isnull = False ) . order_by ( 'id' ) #NEWLINE# data_for_template = [ ] #NEWLINE# for instance in instances : #NEWLINE# #INDENT# point = instance . point #NEWLINE# if point : #NEWLINE# #INDENT# data_for_template . append ( { #NEWLINE# #INDENT# 'name' : id_string , #NEWLINE# 'id' : instance . uuid , #NEWLINE# 'lat' : dd . y , #NEWLINE# 'lng' : point . x , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# return data_for_template