Skip to main content

Folium-VectorGrid

VectorGrid.protobuf plugin for Folium
Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. License
  5. Contact

About The Project

Now part of folium plugins as of v0.13.0.

This library fills a hole in foliums plugin eco-system. Wrapping Leaflet.VectorGrid into a folium plugin, users can now add vector tile layers (e.g. Mapbox, OpenMapTiles) to their folium maps.

Built With

Getting Started

Prerequisite

Install Poetry.

Installation

as dependency

poetry add git+https://github.com/iwpnd/folium-vectorgrid.git
pip install folium-vectorgrid

local development

  1. Clone and install
    git clone https://github.com/iwpnd/folium-vectorgrid.git
    poetry install
    
  2. Test it!
    poe test  # or poetry run pytest .
    

Usage

from folium_vectorgrid import VectorGridProtobuf
import folium

url = "https://free-{s}.tilehosting.com/data/v3/{z}/{x}/{y}.pbf?token={token}"

m = folium.Map()
options = {
    "subdomain": "my_subdomain",
    "token": "my_token",
    "vectorTileLayerStyles": {
        "my_layer":{
            "fill": True,
            "weight": 1,
            "fillColor": 'green',
            "color": 'black',
            "fillOpacity":0.6,
            "opacity":0.6
        },
    }
}

vc = VectorGridProtobuf(url, "folium_layer_name", options)
m.add_child(vc)
m

Or with conditional styling

import folium
from folium_vectorgrid import VectorGridProtobuf

m = folium.Map()
url = "https://free-{s}.tilehosting.com/data/v3/{z}/{x}/{y}.pbf?token={token}"

options = '''{
  "subdomain": "tilehosting",
  "token": "af6P2G9dztAt1F75x7KYt0Hx2DJR052G",
  "vectorTileLayerStyles": {
    "my_layer": function(f) {
      if (f.type === 'parks') {
        return {
          "fill": true,
          "weight": 1,
          "fillColor": 'green',
          "color": 'black',
          "fillOpacity":0.6,
          "opacity":0.6
        };
      }

      if (f.type === 'water') {
        return {
          "fill": true,
          "weight": 1,
          "fillColor": 'purple',
          "color": 'black',
          "fillOpacity":0.6,
          "opacity":0.6
        };
      }
    }
  }
}'''

VectorGridProtobuf(url,"layer_name",options).add_to(m)
m

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Benjamin Ramser - @imwithpanda - ahoi@iwpnd.pw
Project Link: https://github.com/iwpnd/folium-vector

Metadata

Release files for folium-vectorgrid 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for folium-vectorgrid 0.1.3
File Size Uploaded Provenance
folium_vectorgrid-0.1.3.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for folium-vectorgrid 0.1.3
File Interpreter ABI Platform
folium_vectorgrid-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / folium_vectorgrid-0.1.3.tar.gz

Download URL folium_vectorgrid-0.1.3.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f838be4fd7e2d44b20bb8852ecf96eca4f828659544f8aecce9887d013aed928
BLAKE2b-256 checksum
How to use checksums
1bc27a59cc97fe0d6428a386f4350104e35e25ea0f9bf89ee9d6465f76ee87be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / folium_vectorgrid-0.1.3-py3-none-any.whl

Download URL folium_vectorgrid-0.1.3-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0815df4f519bf422b4459b8b8d0c151e2f7c36fa699032dfb36c01891bd18b14
BLAKE2b-256 checksum
How to use checksums
6bd3d5abfa39de3d232c9b09be4f17f5195023c3d90d08d2d1e0438d35be44b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Security for folium-vectorgrid 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page