1. prettymapsPython 地圖繪制工具庫

        聯(lián)合創(chuàng)作 · 2023-09-28 00:24

        prettymaps 是 Python 編寫的將 OpenStreetMap 數(shù)據(jù)繪制漂亮的地圖的工具,項(xiàng)目基于 osmnx、matplotlib 和 shape 庫。

        示例

        # Init matplotlib figure
        fig, ax = plt.subplots(figsize = (12, 12), constrained_layout = True)
        
        backup = plot(
            # Address:
            'Pra?a Ferreira do Amaral, Macau',
            # Plot geometries in a circle of radius:
            radius = 1100,
            # Matplotlib axis
            ax = ax,
            # Which OpenStreetMap layers to plot and their parameters:
            layers = {
                    # Perimeter (in this case, a circle)
                    'perimeter': {},
                    # Streets and their widths
                    'streets': {
                        'width': {
                            'motorway': 5,
                            'trunk': 5,
                            'primary': 4.5,
                            'secondary': 4,
                            'tertiary': 3.5,
                            'residential': 3,
                            'service': 2,
                            'unclassified': 2,
                            'pedestrian': 2,
                            'footway': 1,
                        }
                    },
                    # Other layers:
                    #   Specify a name (for example, 'building') and which OpenStreetMap tags to fetch
                    'building': {'tags': {'building': True, 'landuse': 'construction'}, 'union': False},
                    'water': {'tags': {'natural': ['water', 'bay']}},
                    'green': {'tags': {'landuse': 'grass', 'natural': ['island', 'wood'], 'leisure': 'park'}},
                    'forest': {'tags': {'landuse': 'forest'}},
                    'parking': {'tags': {'amenity': 'parking', 'highway': 'pedestrian', 'man_made': 'pier'}}
                },
                # drawing_kwargs:
                #   Reference a name previously defined in the 'layers' argument and specify matplotlib parameters to draw it
                drawing_kwargs = {
                    'background': {'fc': '#F2F4CB', 'ec': '#dadbc1', 'hatch': 'ooo...', 'zorder': -1},
                    'perimeter': {'fc': '#F2F4CB', 'ec': '#dadbc1', 'lw': 0, 'hatch': 'ooo...',  'zorder': 0},
                    'green': {'fc': '#D0F1BF', 'ec': '#2F3737', 'lw': 1, 'zorder': 1},
                    'forest': {'fc': '#64B96A', 'ec': '#2F3737', 'lw': 1, 'zorder': 1},
                    'water': {'fc': '#a1e3ff', 'ec': '#2F3737', 'hatch': 'ooo...', 'hatch_c': '#85c9e6', 'lw': 1, 'zorder': 2},
                    'parking': {'fc': '#F2F4CB', 'ec': '#2F3737', 'lw': 1, 'zorder': 3},
                    'streets': {'fc': '#2F3737', 'ec': '#475657', 'alpha': 1, 'lw': 0, 'zorder': 3},
                    'building': {'palette': ['#FFC857', '#E9724C', '#C5283D'], 'ec': '#2F3737', 'lw': .5, 'zorder': 4},
                }
        )
        

        瀏覽 15
        點(diǎn)贊
        評論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
        評論
        圖片
        表情
        推薦
        點(diǎn)贊
        評論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
          
          

            1. 北条麻妃中文字幕黄色片子 | 亚洲高清在线观看 | 国产精品久久又色又热 | 啪啪免费视频 | 日日操日日干 |