changeset 256:cb953cc153a6

GIS-Links from MPDL-Documents now served by Mappit-Server
author fknauft
date Wed, 28 Sep 2011 18:46:00 +0200
parents ec7b63319fad
children 61525f0ca492
files RestDbGisApi.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/RestDbGisApi.py	Wed Sep 28 17:43:50 2011 +0200
+++ b/RestDbGisApi.py	Wed Sep 28 18:46:00 2011 +0200
@@ -583,8 +583,14 @@
         coordlist=[]
         i=0
         while (i<5 and coordlist==[]):
-            urlresponse=urlFunctions.zUrlopenParseString(self,urlFunctions.zUrlopenRead(self,"http://chgis.hmdc.harvard.edu/xml/id/"+gis_id))
-            baseDocElement= urlFunctions.zUrlopenDocumentElement(self,urlresponse)
+            urlinfo=urlFunctions.zUrlopenInfo(self,"http://chgis.hmdc.harvard.edu/xml/id/"+gis_id)
+            urlinfoLength=urlinfo.get('content-length')
+            if int(urlinfoLength)<500:
+                urlresponse=urlFunctions.zUrlopenRead(self,"http://chgis.hmdc.harvard.edu/xml/id/cts_"+gis_id)
+            else:
+                urlresponse=urlFunctions.zUrlopenRead(self,"http://chgis.hmdc.harvard.edu/xml/id/"+gis_id)
+            urlresponseString=urlFunctions.zUrlopenParseString(self,urlresponse)
+            baseDocElement= urlFunctions.zUrlopenDocumentElement(self,urlresponseString)
             childnodes=urlFunctions.zUrlopenChildNodes(self,baseDocElement)
             itemnodes=urlFunctions.zUrlopenGetElementsByTagName(self,baseDocElement,'item')
             itemspatialnodes=None