# HG changeset patch # User fknauft # Date 1317224630 -7200 # Node ID ec7b63319fad6b1950e34b1d02c8407bb2bbbd0c # Parent 901c1f745d13414798befc16b15698dfd3da37c7 GIS-Links from MPDL-Documents now served by Mappit-Server diff -r 901c1f745d13 -r ec7b63319fad RestDbGisApi.py --- a/RestDbGisApi.py Wed Sep 28 15:09:14 2011 +0200 +++ b/RestDbGisApi.py Wed Sep 28 17:43:50 2011 +0200 @@ -159,7 +159,7 @@ idList = None if ids is not None: qstr += ' WHERE ' - if table=='mpdl': + if schema=='mpdl': qstr += 'mpdl_xmlsource_id IN (' else: qstr += 'CAST(id AS text) IN (' @@ -187,7 +187,7 @@ bad_luck=False bl_counter=bl_counter+1 except: - if (bl_counter<100): + if (bl_counter<5): bad_luck=True else: bad_luck=False @@ -216,15 +216,14 @@ res = self.executeSQL(sql, (table,'gis_id')) if len(res['rows']) > 0: gisIdField = res['rows'][0][0] - else: - # latitude in metadata - res = self.executeSQL(sql, (table,'coord_lat')) - if len(res['rows']) > 0: - latField = res['rows'][0][0] - # longitude in metadata - res = self.executeSQL(sql, (table,'coord_lon')) - if len(res['rows']) > 0: - lonField = res['rows'][0][0] + # latitude in metadata + res = self.executeSQL(sql, (table,'coord_lat')) + if len(res['rows']) > 0: + latField = res['rows'][0][0] + # longitude in metadata + res = self.executeSQL(sql, (table,'coord_lon')) + if len(res['rows']) > 0: + lonField = res['rows'][0][0] if (gisIdField is None) and (latField is None or lonField is None) and geomField=='point': logging.warning("no entry in metadata table for table %s" % table) @@ -266,14 +265,17 @@ # for dataset in data['rows']: xCoord = 0.0 yCoord = 0.0 - if gisIdIdx is not None and geomField=='point' : + if gisIdIdx != None and geomField=='point' : gisID = dataset[gisIdIdx] - coords=self.getPointForChGisId(gisID) - if coords!=None: - xCoord=coords[0] - yCoord=coords[1] - - elif latIdx is not None: + if gisID != " ": + coords=self.getPointForChGisId(gisID) + if coords!=None: + xCoord=coords[0] + yCoord=coords[1] + elif latIdx != None: + xCoord = dataset[lonIdx] + yCoord = dataset[latIdx] + elif latIdx != None: xCoord = dataset[lonIdx] yCoord = dataset[latIdx] diff -r 901c1f745d13 -r ec7b63319fad zpt/KML_schema_table.zpt --- a/zpt/KML_schema_table.zpt Wed Sep 28 15:09:14 2011 +0200 +++ b/zpt/KML_schema_table.zpt Wed Sep 28 17:43:50 2011 +0200 @@ -1,10 +1,10 @@ - - + 1 116.38,39.92,0