Mercurial > hg > ChinaGisRestApi
comparison RestDbGisApi.py @ 260:e9a1ac7d2ab2
Bug resolved in request point_id from Harvard ChGIS
author | fknauft |
---|---|
date | Fri, 07 Oct 2011 12:25:21 +0200 |
parents | 17b2c2dba0fd |
children | 5b38b50052e4 |
comparison
equal
deleted
inserted
replaced
259:17b2c2dba0fd | 260:e9a1ac7d2ab2 |
---|---|
368 kmlData.append(kmlPlace) | 368 kmlData.append(kmlPlace) |
369 #logging.debug("kmlData=%s"%(repr(kmlData))) | 369 #logging.debug("kmlData=%s"%(repr(kmlData))) |
370 return kmlData | 370 return kmlData |
371 | 371 |
372 def getPointForChGisId(self, gis_id): | 372 def getPointForChGisId(self, gis_id): |
373 """returns coordinate pair for given gis_id""" | 373 """returns coordinate pair for given gis_id""" # gets called by getKml |
374 def getPoint(id): | 374 def getPoint(id): |
375 str_gis_id=str(id).split('.')[0] | 375 str_gis_id=str(id).split('.')[0] |
376 sql="SELECT x_coord,y_coord FROM chgis.chgis_coords WHERE gis_id LIKE CAST('%s' AS text)"%str(str_gis_id) | 376 sql="SELECT x_coord,y_coord FROM chgis.chgis_coords WHERE gis_id LIKE CAST('%s' AS text)"%str(str_gis_id) |
377 # logging.error("sql:",sql) | 377 # logging.error("sql:",sql) |
378 # res = self.executeSQL(sql, (str(str_gis_id),)) | 378 # res = self.executeSQL(sql, (str(str_gis_id),)) |
382 else: | 382 else: |
383 #logging.error("error on sql:",sql%(str(str_gis_id),)) | 383 #logging.error("error on sql:",sql%(str(str_gis_id),)) |
384 return None | 384 return None |
385 | 385 |
386 if gis_id is None or gis_id == "": | 386 if gis_id is None or gis_id == "": |
387 return None | |
388 if len(gis_id) < 4: | |
387 return None | 389 return None |
388 | 390 |
389 # try gis_id | 391 # try gis_id |
390 coords = getPoint(gis_id) | 392 coords = getPoint(gis_id) |
391 if coords is None: | 393 if coords is None: |