Created
March 24, 2017 15:27
-
-
Save procrastinatio/92d6034390b569b9102f1b687c5bd9a4 to your computer and use it in GitHub Desktop.
Testing Geneva's WMS services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import owslib | |
from owslib.wms import WebMapService | |
import requests | |
import lxml | |
urls= ['https://ge.ch/sitgags1/services/VECTOR/SITG_OPENDATA_01/MapServer/WMSServer', | |
'https://ge.ch/sitgags1/services/VECTOR/SITG_OPENDATA_02/MapServer/WMSServer', | |
'https://ge.ch/sitgags1/services/VECTOR/SITG_OPENDATA_03/MapServer/WMSServer', | |
'https://ge.ch/sitgags1/services/VECTOR/SITG_OPENDATA_04/MapServer/WMSServer', | |
'https://ge.ch/sitgags1/services/VECTOR/SITG_GEOSERVICEDATA/MapServer/WMSServer', | |
'https://ge.ch/sitgags2/rest/services/RASTER'] | |
for url in urls: | |
print url, | |
try: | |
wms = WebMapService(url, version='1.1.1') | |
#print wms.identification.type | |
print "title={}, layers={}".format(wms.identification.title, ",".join([wms[i].title for i in wms.contents])) | |
except owslib.util.ServiceException: | |
print "not an WMS service" | |
except requests.packages.urllib3.exceptions.ConnectTimeoutError as e: | |
print "Connection timeout", e | |
except lxml.etree.XMLSyntaxError as e: | |
print "XML parse error" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment