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


Python GMapPlot.api_key方法代码示例

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


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

示例1: main

# 需要导入模块: from bokeh.models import GMapPlot [as 别名]
# 或者: from bokeh.models.GMapPlot import api_key [as 别名]

#.........这里部分代码省略.........
                descr = child.get('Description')
                healtheffect = child.get('HealthEffect')

        elif app.vars['species'] == 'sulphur dioxide':

            for child in root.findall(".//*[@SpeciesCode='SO2']/..[@Latitude]"):
                x = child.get('Latitude')
                latitudes.append(x)
                x = child.get('SiteName')
                sites.append(x)
                x = child.get('Longitude')
                longitudes.append(x)
                x = child.get('BulletinDate')
                app.vars['date'] = x

            for child in root.findall(".//*[@SpeciesCode='SO2']"):
                x = child.get('AirQualityIndex')
                AQIs.append(x)

            for child in info_root.findall(".//*[@SpeciesCode='SO2']"):

                descr = child.get('Description')
                healtheffect = child.get('HealthEffect')


        for AQI in AQIs:
            if AQI =='0':
                AQI_color = AQI.replace('0','grey')
            if AQI =='1':
                AQI_color = AQI.replace('1','forestgreen')
            if AQI =='2':
                AQI_color = AQI.replace('2','lawngreen')
            if AQI =='3':
                AQI_color = AQI.replace('3','gold')
            if AQI =='4':
                AQI_color = AQI.replace('4','darkorange')
            if AQI =='5':
                AQI_color = AQI.replace('5','orangered')
            if AQI =='6':
                AQI_color = AQI.replace('6','red')
            if AQI =='7':
                AQI_color = AQI.replace('7','magenta')
            if AQI =='8':
                AQI_color = AQI.replace('6','blueviolet')
            if AQI =='9':
                AQI_color = AQI.replace('9','blue')
            if AQI =='10':
                AQI_color = AQI.replace('10','black')

            AQI_colors.append(AQI_color)

        map_options = GMapOptions(lat=51.4908308, lng=-0.1407765, map_type="roadmap", zoom=10)
        plot = GMapPlot(x_range=DataRange1d(), y_range=DataRange1d(), map_options=map_options, plot_width=740, plot_height=650,  toolbar_location="below")
        # plot.title.text= "AQIs"
        plot.api_key="AIzaSyA7Adc9av0W2hSf72F3VwepL-MqQvs5Hes"
        #
        source = ColumnDataSource(
        data = dict(
        lat = latitudes,
        lon = longitudes,
        color = AQI_colors,
        sites = sites,
        AQIs = AQIs))
        #
        #
        circle = Circle(x = "lon", y = "lat", size=14, fill_color="color", fill_alpha=0.5, line_color=None)
        plot.add_glyph(source, circle)
        #
        #
        plot.add_tools(PanTool(), WheelZoomTool(), BoxSelectTool(), HoverTool())
        #
        #
        hover = plot.select(dict(type=HoverTool))
        #
        #
        #
        hover.tooltips="""
        <!DOCTYPE html>
        <html lang="en">
            <head>
                <link rel=stylesheet type=text/css href='{{ url_for('static',filename='style_input_ht.css')}}'>

        <div>
            <div>
                <span style="font-size: 17px; color:black;">@sites</span>

            </div>
            <div>
                <span style="font-size: 15px; color: black;">AQI</span>
                <span style="font-size: 15px; color: black;">@AQIs</span>
            </div>
        </div>
        """

        script, div = components(plot)

        output_file('templates/map.html')
        # save(plot)

        return render_template('map.html', script=script, div=div, species=app.vars['species'], date=app.vars['date'])#, descr=descr, healtheffect=healtheffect)
开发者ID:lancerane,项目名称:London_AQI,代码行数:104,代码来源:app.py

示例2: GMapOptions

# 需要导入模块: from bokeh.models import GMapPlot [as 别名]
# 或者: from bokeh.models.GMapPlot import api_key [as 别名]
  GMapPlot, GMapOptions, ColumnDataSource, Circle, DataRange1d, PanTool, WheelZoomTool, BoxSelectTool
)

map_options = GMapOptions(lat=38.5, lng=-121.5, map_type="roadmap", zoom=10)

plot = GMapPlot(
    x_range=DataRange1d(), y_range=DataRange1d(), map_options=map_options
)
#plot.title.text = "Austin"

# For GMaps to function, Google requires you obtain and enable an API key:
#
#     https://developers.google.com/maps/documentation/javascript/get-api-key
#
# Replace the value below with your personal API key:
plot.api_key = API_KEY


with open("incidents.json") as f:
    incidents = json.load(f)

pts = [x['point']['coordinates'] for x in incidents]

source = ColumnDataSource(
    data=dict(
        lat=[x[0] for x in pts],
        lon=[x[1] for x in pts],
    )
)

circle = Circle(x="lon", y="lat", size=15, fill_color="blue", fill_alpha=0.8, line_color=None)
开发者ID:clarkfitzg,项目名称:junkyard,代码行数:33,代码来源:maps.py


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