当前位置: 首页>>代码示例>>Python>>正文


Python WebMapService.getdata方法代码示例

本文整理汇总了Python中owslib.wms.WebMapService.getdata方法的典型用法代码示例。如果您正苦于以下问题:Python WebMapService.getdata方法的具体用法?Python WebMapService.getdata怎么用?Python WebMapService.getdata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在owslib.wms.WebMapService的用法示例。


在下文中一共展示了WebMapService.getdata方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: gui_addgeos

# 需要导入模块: from owslib.wms import WebMapService [as 别名]
# 或者: from owslib.wms.WebMapService import getdata [as 别名]
 def gui_addgeos(self,website='http://wms.gsfc.nasa.gov/cgi-bin/wms.cgi?project=GEOS.fp.fcst.inst1_2d_hwl_Nx'):
     'GUI handler for adding the figures from WMS support of GEOS'
     from gui import Popup_list
     try:
         from owslib.wms import WebMapService
         from owslib.util import openURL
         from StringIO import StringIO
         from PIL import Image
         self.line.tb.set_message('Loading WMS from :'+website.split('/')[2])
         wms = WebMapService(website)
         cont = list(wms.contents)
     except Exception as ie:
         print ie
         import tkMessageBox
         tkMessageBox.showwarning('Sorry','Loading WMS map file from '+website.split('/')[2]+' servers not working...')
         return
     titles = [wms[c].title for c in cont]
     arr = [x.split('-')[-1]+':  '+y for x,y in zip(cont,titles)]
     i = Popup_list(arr)
     self.line.tb.set_message('Selected WMS map: '+titles[i].split(',')[-1])
     if wms[cont[i]].timepositions:
         times = wms[cont[i]].timepositions
         j = Popup_list(times)
         time_sel = times[j]
     else:
         time_sel = None
     try:
         if not time_sel:
             time_sel = self.line.ex.datestr+'T12:00'
         ylim = self.line.line.axes.get_ylim()
         xlim = self.line.line.axes.get_xlim()
         #img = wms.getdata(layers=[cont[i]],
         #                  bbox=(ylim[0],xlim[0],ylim[1],xlim[1]),
         #                  size=(480,240),
         #                  transparent=True,
         #                  time=time_sel,
         #                  srs='EPSG:4326',
         #                  format='image/png')
         #leg_call = openURL(img.geturl().replace('GetMap','GetLegend'))
         img = wms.getdata(layers=[cont[i],'countries'],
                           bbox=(ylim[0],xlim[0],ylim[1],xlim[1]),
                           size=(480,240),
                           transparent=True,
                           time=time_sel,
                           srs='EPSG:4326',
                           format='image/png')
         geos = Image.open(StringIO(img.read()))
         self.line.addfigure_under(geos,xlim[0],ylim[0],xlim[1],ylim[1])
         #self.line.line.figure.add
         #leg = Image.open(StringIO(leg_call.read()))
         #self.line.addfigure_under(leg,xlim[0],ylim[0],xlim[1],ylim[1],outside=True)
     except:
         import tkMessageBox
         tkMessageBox.showwarning('Sorry','Problem getting the image to load')
         return
开发者ID:samuelleblanc,项目名称:flight_planning,代码行数:57,代码来源:gui.py


注:本文中的owslib.wms.WebMapService.getdata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。