Mercurial > hg > ChinaGisRestApi
diff RestDbGisApi.py @ 276:55bc9972fb1b
Merge with d1b43624cc63b829f64cc952540748e15272e389
author | casties |
---|---|
date | Thu, 23 Feb 2012 21:29:06 +0100 |
parents | eb8a18f94d2d d1b43624cc63 |
children | 4ade9b80b563 |
line wrap: on
line diff
--- a/RestDbGisApi.py Thu Feb 23 21:13:21 2012 +0100 +++ b/RestDbGisApi.py Thu Feb 23 21:29:06 2012 +0100 @@ -237,7 +237,7 @@ def getLiveKmlUrl(self,schema,table,useTimestamp=True,REQUEST=None): return self.getLiveUrl(schema,table,useTimestamp,REQUEST) - def getKmlData(self, schema, table, ids=None, sortBy=1, gisIdField=None, latField=None, lonField=None, geomField="point", colorField="red_big"): + def getKmlData(self, schema, table, ids=None, sortBy=1, gisIdField=None, latField=None, lonField=None, geomField="point", colorField="red_big",from_year_name='from_year',until_year_name=''): """returns data structure for KML template""" logging.debug("getKMLdata gid=%s lat=%s lon=%s sortBy=%s geom=%s color=%s"%(gisIdField,latField,lonField,sortBy,geomField,colorField)) if geomField is None: @@ -411,18 +411,24 @@ sql = "SELECT field_name FROM public.gis_table_meta_rows WHERE table_name = %s and gis_type = %s" # from_year and until_year in metadata first try: - res = self.executeSQL(sql, (table,'from_year')) + res = self.executeSQL(sql, (table,from_year_name)) if len(res['rows']) > 0: from_year = res['rows'][0][0] except: from_year = "from_year_dummy" try: - res = self.executeSQL(sql, (table,'until_year')) + res = self.executeSQL(sql, (table,until_year_name)) if len(res['rows']) > 0: until_year = res['rows'][0][0] except: until_year = "until_year_dummy" - + + #DW added for testing E4D with names + from_year=from_year_name + until_year=until_year_name + + logging.debug("from_year:"+from_year) + logging.debug("until_year:"+until_year) for i in range (len(dataset)): value = dataset[i] @@ -438,6 +444,7 @@ # continue val = "%s: %s"%(name, value) + logging.debug(name) value=unicode(value) if name == from_year: beg_yr= value @@ -705,6 +712,7 @@ return kmlFileName def trydatahas_key(self,data,index,key_string): + logging.debug("trying:"+key_string) try: return data[index].has_key(key_string) except: