# HG changeset patch # User fknauft # Date 1299147489 -3600 # Node ID dd235873514bacc85fece440e0a2c843d8817810 # Parent 47acfb4a97cf64c1ee4acb21a09f4242396ac2f0 Repair: loading of chgis-polys diff -r 47acfb4a97cf -r dd235873514b RestDbGisApi.py --- a/RestDbGisApi.py Wed Feb 16 17:46:48 2011 +0100 +++ b/RestDbGisApi.py Thu Mar 03 11:18:09 2011 +0100 @@ -197,7 +197,11 @@ geomstr='select astext(st_simplify(transform(the_geom,4326),0.01)) from "%s"."%s"'%(schema,table) geomdata=self.executeSQL(geomstr) except: - geomdata=None + try: + geomstr='select chgis.astext(chgis.st_simplify(chgis.transform(the_geom,4326),0.01)) from "%s"."%s"'%(schema,table) + geomdata=self.executeSQL(geomstr) + except: + geomdata=None if (gisIdField is None) and (latField is None or lonField is None): # no fields given - choose automagically @@ -309,10 +313,10 @@ link_str_end=link_str_end1 if link_str_end > -1: link_str=value[link_str_beg:link_str_end] - val =name+": "+value[0:link_str_beg]+'" ' + link_str + ' "' + value[link_str_end:] + val =name+": "+value[0:link_str_beg]+' ' + link_str.replace('http://','') + ' ' + value[link_str_end:] else: link_str=value[link_str_beg:] - val =name+': '+value[0:link_str_beg]+'" ' + link_str + ' "' + val =name+': '+value[0:link_str_beg]+' ' + link_str.replace('http://','') + ' ' #desc += kmlEncode(val) @@ -323,7 +327,7 @@ if geomField=='point': - kmlPlace['description'] = "%s]]>"%desc + kmlPlace['description'] = ""%desc kmlPlace['icon'] = '#marker_icon_'+colorField kmlPlace['coord_x'] = str(xCoord) @@ -469,7 +473,7 @@ attribute_string=str(attribute_string).replace(';','__$$__') attribute_string=str(attribute_string).replace('&','&') if str(attribute_string).find('http')>-1: - attribute_string='' + str(attribute_string) + '' + attribute_string='' + str(attribute_string) + '' kml4Marker=kml4Marker+attribute_string+"
\n" kml4Marker=kml4Marker+"]]>\n" @@ -491,6 +495,12 @@ isLoadReady=self.RESTwrite2File(self.daten,kmlFileName,kml4Marker) return kmlFileName + + def trydatahas_key(self,data,index,key_string): + try: + return data[index].has_key(key_string) + except: + return 'false' # def getGoogleMapString(self,kml): # logging.debug("getGoogleMapString")