python_pychart_baidu_map_color

map_style=({"style":mp_setstyle}),

在这里插入图片描述

map_style=({"style":'hardedge'}),

在这里插入图片描述

mp_setstyle='normal'

在这里插入图片描述

mp_setstyle='light'

在这里插入图片描述
mp_setstyle=dark在这里插入图片描述

mp_setstyle='bluish'

在这里插入图片描述

mp_setstyle='grayscale'

在这里插入图片描述
mp_setstyle='darkgreen'在这里插入图片描述

mp_setstyle='pink'

在这里插入图片描述

mp_setstyle='midnight'

在这里插入图片描述

mp_setstyle='grassgreen'

在这里插入图片描述

mp_setstyle='googlelite'

在这里插入图片描述
mp_setstyle=‘redalert’

import asyncio
# from aiohttp import TCPConnector, ClientSession

from pyecharts.charts import BMap
from pyecharts import options as opts
from pyecharts.globals import BMapType, ChartType
import requests
# 通过requests获取数据
url="https://echarts.apache.org/examples/data/asset/data/hangzhou-tracks.json"
r = requests.get(url)
data = r.json()
mp_setstyle0 = [ {
               "featureType": "water",
                "elementType": "geometry.fill",
                "stylers": {
                     "color": "#ff0000ff",
                     "hue": "#ff0000",
                     "weight": "1",
                     "lightness": 1,
                     "saturation": 100,
                     "visibility": "on"
                 }
        }]
mp_setstyle='redalert'
#         //模板
#         //默认地图样式(normal)
#         //清新蓝风格(light)
#         //黑夜风格(dark)
#         //清新蓝绿风格(bluish)
#         //高端灰风格(grayscale)
#         //强边界风格(hardedge)
#         //青春绿风格(darkgreen)
#         //浪漫粉风格(pink)
#         //午夜蓝风格(midnight)
#         //自然绿风格(grassgreen)
#         //精简风格(googlelite)
#         //红色警戒风格(redalert)

mp_setstyle_shuiguan = [
                {
                    "featureType": "water",
                    "elementType": "all",
                    "stylers": {"color": "#d1d1d1"},
                },
                {
                    "featureType": "land",
                    "elementType": "all",
                    "stylers": {"color": "#f3f3f3"},
                },
                {
                    "featureType": "railway",
                    "elementType": "all",
                    "stylers": {"visibility": "off"},
                },
                {
                    "featureType": "highway",
                    "elementType": "all",
                    "stylers": {"color": "#fdfdfd"},
                },
                {
                    "featureType": "highway",
                    "elementType": "labels",
                    "stylers": {"visibility": "off"},
                },
                {
                    "featureType": "arterial",
                    "elementType": "geometry",
                    "stylers": {"color": "#fefefe"},
                },
                {
                    "featureType": "arterial",
                    "elementType": "geometry.fill",
                    "stylers": {"color": "#fefefe"},
                },
                {
                    "featureType": "poi",
                    "elementType": "all",
                    "stylers": {"visibility": "off"},
                },
                {
                    "featureType": "green",
                    "elementType": "all",
                    "stylers": {"visibility": "off"},
                },
                {
                    "featureType": "subway",
                    "elementType": "all",
                    "stylers": {"visibility": "off"},
                },
                {
                    "featureType": "manmade",
                    "elementType": "all",
                    "stylers": {"color": "#d1d1d1"},
                },
                {
                    "featureType": "local",
                    "elementType": "all",
                    "stylers": {"color": "#d1d1d1"},
                },
                {
                    "featureType": "arterial",
                    "elementType": "labels",
                    "stylers": {"visibility": "off"},
                },
                {
                    "featureType": "boundary",
                    "elementType": "all",
                    "stylers": {"color": "#fefefe"},
                },
                {
                    "featureType": "building",
                    "elementType": "all",
                    "stylers": {"color": "#d1d1d1"},
                },
                {
                    "featureType": "label",
                    "elementType": "labels.text.fill",
                    "stylers": {"color": "#999999"},
                },
            ]

map_data = [[y["coord"] for y in x] for x in data]

c=(
    BMap(init_opts=opts.InitOpts(width="1200px", height="800px"))
    .add_schema(
        # baidu_ak="FAKE_AK",
        baidu_ak="Bg8ou4zGbCvgFGXzZo00gMrc0F6ZMUdH",

        center=[120.13066322374, 30.240018034923],
        zoom=14,
        is_roam=True,
        # map_style={ "styleJson":mp_setstyle_shuiguan},
        map_style=({"style":mp_setstyle}),
    )
    .add(
        series_name="",
        type_=ChartType.LINES,
        data_pair=map_data,
        is_polyline=True,
        is_large=True,
        linestyle_opts=opts.LineStyleOpts(color="purple", opacity=0.6, width=1),
        effect_opts=opts.EffectOpts(trail_length=0.5),
    )
    .add_control_panel(
        copyright_control_opts=opts.BMapCopyrightTypeOpts(position=3),
        maptype_control_opts=opts.BMapTypeControlOpts(
            type_=BMapType.MAPTYPE_CONTROL_DROPDOWN
        ),
        scale_control_opts=opts.BMapScaleControlOpts(),
        overview_map_opts=opts.BMapOverviewMapControlOpts(is_open=True),
        navigation_control_opts=opts.BMapNavigationControlOpts(),
        geo_location_control_opts=opts.BMapGeoLocationControlOpts(),
    )
    .render("hiking_trail_in_hangzhou1.html")
)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值