changeset 207:dd235873514b

Repair: loading of chgis-polys
author fknauft
date Thu, 03 Mar 2011 11:18:09 +0100
parents 47acfb4a97cf
children 267c84193e3c
files RestDbGisApi.py
diffstat 1 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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]+'<a href="' + link_str + ' " target="_blank">" ' + link_str + ' "</a>' + value[link_str_end:]
+                            val =name+": "+value[0:link_str_beg]+'<a href=' + link_str + '> ' + link_str.replace('http://','') + ' </a>' + value[link_str_end:]
                         else: 
                             link_str=value[link_str_beg:]
-                            val =name+': '+value[0:link_str_beg]+'<a href="' + link_str + ' " target="_blank">" ' + link_str + ' "</a>'
+                            val =name+': '+value[0:link_str_beg]+'<a href=' + link_str + '> ' + link_str.replace('http://','') + '  </a>'
 
                             
                     #desc += kmlEncode(val)
@@ -323,7 +327,7 @@
             
                   
             if geomField=='point':
-                kmlPlace['description'] = "<![CDATA[<div>%s</div>]]>"%desc
+                kmlPlace['description'] = "<![CDATA[%s]]>"%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('&','&amp;')
                                 if str(attribute_string).find('http')>-1:
-                                    attribute_string='<A HREF=' + str(attribute_string) + ' target=_blank>' + str(attribute_string) + '</A>'
+                                    attribute_string='<A HREF=' + str(attribute_string) + ' target="_blank">' + str(attribute_string) + '</A>'
                                 kml4Marker=kml4Marker+attribute_string+"</a><br>\n"
                                   
                         kml4Marker=kml4Marker+"]]></description>\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")