def kml(self, table, row_id): cl = FT(settings.FT_CONSUMER_KEY, settings.FT_CONSUMER_SECRET, settings.FT_TOKEN, settings.FT_SECRET) # TODO: do this better if table == 1568452: id = "ex_area" else: id = "name" info = cl.sql("select geometry from %s where %s = %s" % (table, id, row_id)) polygon = info.split("\n")[1] polygon = polygon.replace('"', "") return polygon
def kml(self, table, row_id): cl = FT(settings.FT_CONSUMER_KEY, settings.FT_CONSUMER_SECRET, settings.FT_TOKEN, settings.FT_SECRET) #TODO: do this better if (table == 1568452): id = 'ex_area' else: id = 'name' info = cl.sql("select geometry from %s where %s = %s" % (table, id, row_id)) polygon = info.split('\n')[1] polygon = polygon.replace("\"", "") return polygon
def fusion_tables_names(): """ precache de fusion tables names """ for x in FustionTablesNames.all(): x.delete() cl = FT(settings.FT_CONSUMER_KEY, settings.FT_CONSUMER_SECRET, settings.FT_TOKEN, settings.FT_SECRET) for desc, table, name in tables: info = cl.sql("select %s, description from %s" % (name, table)) data = [] # sorry for line in info.split('\n')[1:]: if line: tk = line.split(',') #TODO: fix html decoding data.append((tk[0], tk[1])) FustionTablesNames(table_id=str(table), json=json.dumps(dict(data))).put() return "working"