Mercurial > hg > ChinaGisRestApi
changeset 94:e76dd62f93fd
merge
with 399148bf9b3ad57da913ae440cc5f96e5d1b02bd
author | casties |
---|---|
date | Wed, 26 Jan 2011 12:58:06 +0100 |
parents | c23bcd6030a4 (diff) 399148bf9b3a (current diff) |
children | 75229d2567ba |
files | .project gis_gui/icons/mappit_state.png |
diffstat | 2 files changed, 31 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/.project Wed Jan 26 10:58:04 2011 +0100 +++ b/.project Wed Jan 26 12:58:06 2011 +0100 @@ -7,12 +7,19 @@ </projects> <buildSpec> <buildCommand> - <name>org.python.pydev.PyDevBuilder</name> + <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.python.pydev.pythonNature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + <nature>org.eclipse.wst.jsdt.core.jsNature</nature> </natures> </projectDescription>
--- 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)