# HG changeset patch # User casties # Date 1296043086 -3600 # Node ID e76dd62f93fd845c524f7b81de4c290ddcca62ba # Parent c23bcd6030a4ee6ae53f0edcdfb1154ca86109d9# Parent 399148bf9b3ad57da913ae440cc5f96e5d1b02bd merge with 399148bf9b3ad57da913ae440cc5f96e5d1b02bd diff -r 399148bf9b3a -r e76dd62f93fd .project --- a/.project Wed Jan 26 10:58:04 2011 +0100 +++ b/.project Wed Jan 26 12:58:06 2011 +0100 @@ -7,12 +7,19 @@ - org.python.pydev.PyDevBuilder + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.wst.common.project.facet.core.builder org.python.pydev.pythonNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature diff -r 399148bf9b3a -r e76dd62f93fd RestDbGisApi.py --- a/RestDbGisApi.py Wed Jan 26 10:58:04 2011 +0100 +++ b/RestDbGisApi.py Wed Jan 26 12:58:06 2011 +0100 @@ -190,24 +190,34 @@ if (gisIdField is None) and (latField is None or lonField is None): # no fields given - choose automagically + sql = 'SELECT field_name FROM public.gis_table_meta_rows WHERE table_name = %s and gis_type = %s' # gis id in metadata first - #SQL='SELECT "attribute with gis_id" FROM public.metadata WHERE tablename = %s' - sql = 'SELECT field_name FROM public.gis_table_meta_rows WHERE table_name = %s and gis_type = %s' res = self.executeSQL(sql, (table,'gis_id')) if len(res['rows']) > 0: gisIdField = res['rows'][0][0] else: - logging.warning("no entry in metadata table for table %s"%table) - # try field names - if 'latitude' in fieldMap and 'longitude' in fieldMap: - latField = 'latitude' - lonField = 'longitude' - elif 'x_coord' in fieldMap and 'y_coord' in fieldMap: - latField = 'x_coord' - lonField = 'y_coord' - else: - logging.error("getKMLdata unable to find position fields") - return None + # 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): + logging.warning("no entry in metadata table for table %s" % table) + # still no fields - try field names + if 'latitude' in fieldMap and 'longitude' in fieldMap: + latField = 'latitude' + lonField = 'longitude' + elif 'x_coord' in fieldMap and 'y_coord' in fieldMap: + latField = 'x_coord' + lonField = 'y_coord' + else: + logging.error("getKMLdata unable to find position fields") + return None + # convert field names to row indexes gisIdIdx = fieldMap.get(gisIdField,None) diff -r 399148bf9b3a -r e76dd62f93fd gis_gui/icons/mappit_state.png