folium-vectorgrid


Namefolium-vectorgrid JSON
Version 0.1.2 PyPI version JSON
download
home_page
SummaryVectorGrid plugin for folium
upload_time2024-03-10 11:47:17
maintainer
docs_urlNone
authorBenjamin Ramser
requires_python>=3.9,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <br />
<p align="center">
  <h3 align="center">Folium-VectorGrid</h3>

  <p align="center">
    VectorGrid.protobuf plugin for Folium
    <br />
    <a href="https://github.com/iwpnd/folium-vector/issues">Report Bug</a>
    ยท
    <a href="https://github.com/iwpnd/folium-vector/issues">Request Feature</a>
  </p>
</p>

<!-- TABLE OF CONTENTS -->
<details open="open">
  <summary><h2 style="display: inline-block">Table of Contents</h2></summary>
  <ol>
    <li>
      <a href="#about-the-project">About The Project</a>
      <ul>
        <li><a href="#built-with">Built With</a></li>
      </ul>
    </li>
    <li>
      <a href="#getting-started">Getting Started</a>
      <ul>
        <li><a href="#installation">Installation</a></li>
      </ul>
    </li>
    <li><a href="#usage">Usage</a></li>
    <li><a href="#license">License</a></li>
    <li><a href="#contact">Contact</a></li>
  </ol>
</details>

<!-- ABOUT THE PROJECT -->

## About The Project

Now part of folium plugins as of [v0.13.0](https://github.com/python-visualization/folium/releases/tag/v0.13.0).

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

### Built With

-   [folium](https://github.com/python-visualization/folium)
-   [Leaflet.VectorGrid](https://github.com/Leaflet/Leaflet.VectorGrid)

<!-- GETTING STARTED -->

## Getting Started

### Prerequisite

Install [Poetry](https://python-poetry.org/docs/#installation).

### Installation

#### as dependency

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

```
pip install folium-vectorgrid
```

#### local development

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

## Usage

```python
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

```python
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](https://twitter.com/imwithpanda) - ahoi@iwpnd.pw  
Project Link: [https://github.com/iwpnd/folium-vector](https://github.com/iwpnd/folium-vectorgrid)


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "folium-vectorgrid",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Benjamin Ramser",
    "author_email": "iwpnd@posteo.de",
    "download_url": "https://files.pythonhosted.org/packages/36/0a/fb8be3da14a02900026beb0d5adfa6b92553a21c4c04cb4d53c169692192/folium_vectorgrid-0.1.2.tar.gz",
    "platform": null,
    "description": "<br />\n<p align=\"center\">\n  <h3 align=\"center\">Folium-VectorGrid</h3>\n\n  <p align=\"center\">\n    VectorGrid.protobuf plugin for Folium\n    <br />\n    <a href=\"https://github.com/iwpnd/folium-vector/issues\">Report Bug</a>\n    \u00b7\n    <a href=\"https://github.com/iwpnd/folium-vector/issues\">Request Feature</a>\n  </p>\n</p>\n\n<!-- TABLE OF CONTENTS -->\n<details open=\"open\">\n  <summary><h2 style=\"display: inline-block\">Table of Contents</h2></summary>\n  <ol>\n    <li>\n      <a href=\"#about-the-project\">About The Project</a>\n      <ul>\n        <li><a href=\"#built-with\">Built With</a></li>\n      </ul>\n    </li>\n    <li>\n      <a href=\"#getting-started\">Getting Started</a>\n      <ul>\n        <li><a href=\"#installation\">Installation</a></li>\n      </ul>\n    </li>\n    <li><a href=\"#usage\">Usage</a></li>\n    <li><a href=\"#license\">License</a></li>\n    <li><a href=\"#contact\">Contact</a></li>\n  </ol>\n</details>\n\n<!-- ABOUT THE PROJECT -->\n\n## About The Project\n\nNow part of folium plugins as of [v0.13.0](https://github.com/python-visualization/folium/releases/tag/v0.13.0).\n\nThis library fills a hole in foliums plugin eco-system. Wrapping [Leaflet.VectorGrid](https://github.com/Leaflet/Leaflet.VectorGrid/) into a folium plugin, users can now add vector tile layers (e.g. Mapbox, OpenMapTiles) to their folium maps.\n\n### Built With\n\n-   [folium](https://github.com/python-visualization/folium)\n-   [Leaflet.VectorGrid](https://github.com/Leaflet/Leaflet.VectorGrid)\n\n<!-- GETTING STARTED -->\n\n## Getting Started\n\n### Prerequisite\n\nInstall [Poetry](https://python-poetry.org/docs/#installation).\n\n### Installation\n\n#### as dependency\n\n```\npoetry add git+https://github.com/iwpnd/folium-vectorgrid.git\n```\n\n```\npip install folium-vectorgrid\n```\n\n#### local development\n\n1. Clone and install\n    ```sh\n    git clone https://github.com/iwpnd/folium-vectorgrid.git\n    poetry install\n    ```\n2. Test it!\n    ```sh\n    poe test  # or poetry run pytest .\n    ```\n\n## Usage\n\n```python\nfrom folium_vectorgrid import VectorGridProtobuf\nimport folium\n\nurl = \"https://free-{s}.tilehosting.com/data/v3/{z}/{x}/{y}.pbf?token={token}\"\n\nm = folium.Map()\noptions = {\n    \"subdomain\": \"my_subdomain\",\n    \"token\": \"my_token\",\n    \"vectorTileLayerStyles\": {\n        \"my_layer\":{\n            \"fill\": True,\n            \"weight\": 1,\n            \"fillColor\": 'green',\n            \"color\": 'black',\n            \"fillOpacity\":0.6,\n            \"opacity\":0.6\n        },\n    }\n}\n\nvc = VectorGridProtobuf(url, \"folium_layer_name\", options)\nm.add_child(vc)\nm\n```\n\nOr with conditional styling\n\n```python\nimport folium\nfrom folium_vectorgrid import VectorGridProtobuf\n\nm = folium.Map()\nurl = \"https://free-{s}.tilehosting.com/data/v3/{z}/{x}/{y}.pbf?token={token}\"\n\noptions = '''{\n  \"subdomain\": \"tilehosting\",\n  \"token\": \"af6P2G9dztAt1F75x7KYt0Hx2DJR052G\",\n  \"vectorTileLayerStyles\": {\n    \"my_layer\": function(f) {\n      if (f.type === 'parks') {\n        return {\n          \"fill\": true,\n          \"weight\": 1,\n          \"fillColor\": 'green',\n          \"color\": 'black',\n          \"fillOpacity\":0.6,\n          \"opacity\":0.6\n        };\n      }\n\n      if (f.type === 'water') {\n        return {\n          \"fill\": true,\n          \"weight\": 1,\n          \"fillColor\": 'purple',\n          \"color\": 'black',\n          \"fillOpacity\":0.6,\n          \"opacity\":0.6\n        };\n      }\n    }\n  }\n}'''\n\nVectorGridProtobuf(url,\"layer_name\",options).add_to(m)\nm\n```\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n## Contact\n\nBenjamin Ramser - [@imwithpanda](https://twitter.com/imwithpanda) - ahoi@iwpnd.pw  \nProject Link: [https://github.com/iwpnd/folium-vector](https://github.com/iwpnd/folium-vectorgrid)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "VectorGrid plugin for folium",
    "version": "0.1.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "09855ee00f2f2dcb39d9a4d698c028e7d70deeede0dd172b60cae857cd3f9113",
                "md5": "468204337ba09eed51057861be1a9e52",
                "sha256": "8598a287df152f15ec8f81679155fb108106e09e25b34734c0a40f7b91e3ff6d"
            },
            "downloads": -1,
            "filename": "folium_vectorgrid-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "468204337ba09eed51057861be1a9e52",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 4906,
            "upload_time": "2024-03-10T11:47:15",
            "upload_time_iso_8601": "2024-03-10T11:47:15.952956Z",
            "url": "https://files.pythonhosted.org/packages/09/85/5ee00f2f2dcb39d9a4d698c028e7d70deeede0dd172b60cae857cd3f9113/folium_vectorgrid-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "360afb8be3da14a02900026beb0d5adfa6b92553a21c4c04cb4d53c169692192",
                "md5": "a1beda60f9b3f3f9778ef284712ad6e2",
                "sha256": "98b6721bef208d01b707ce382bd2ba98b926f74d0846f704e353a2321ceec366"
            },
            "downloads": -1,
            "filename": "folium_vectorgrid-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a1beda60f9b3f3f9778ef284712ad6e2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 4619,
            "upload_time": "2024-03-10T11:47:17",
            "upload_time_iso_8601": "2024-03-10T11:47:17.500768Z",
            "url": "https://files.pythonhosted.org/packages/36/0a/fb8be3da14a02900026beb0d5adfa6b92553a21c4c04cb4d53c169692192/folium_vectorgrid-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-10 11:47:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "folium-vectorgrid"
}
        
Elapsed time: 0.18377s