folium-vectorgrid


Namefolium-vectorgrid JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryVectorGrid plugin for folium
upload_time2024-07-01 19:29:58
maintainerNone
docs_urlNone
authorBenjamin Ramser
requires_python<4.0,>=3.9
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": null,
    "name": "folium-vectorgrid",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Benjamin Ramser",
    "author_email": "iwpnd@posteo.de",
    "download_url": "https://files.pythonhosted.org/packages/1b/c2/7a59cc97fe0d6428a386f4350104e35e25ea0f9bf89ee9d6465f76ee87be/folium_vectorgrid-0.1.3.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.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6bd3d5abfa39de3d232c9b09be4f17f5195023c3d90d08d2d1e0438d35be44b8",
                "md5": "2ca77c5dbd821629a5a8638cabe200bf",
                "sha256": "0815df4f519bf422b4459b8b8d0c151e2f7c36fa699032dfb36c01891bd18b14"
            },
            "downloads": -1,
            "filename": "folium_vectorgrid-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2ca77c5dbd821629a5a8638cabe200bf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 4907,
            "upload_time": "2024-07-01T19:29:57",
            "upload_time_iso_8601": "2024-07-01T19:29:57.660349Z",
            "url": "https://files.pythonhosted.org/packages/6b/d3/d5abfa39de3d232c9b09be4f17f5195023c3d90d08d2d1e0438d35be44b8/folium_vectorgrid-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1bc27a59cc97fe0d6428a386f4350104e35e25ea0f9bf89ee9d6465f76ee87be",
                "md5": "c72210ec6f020573a09a792377a84287",
                "sha256": "f838be4fd7e2d44b20bb8852ecf96eca4f828659544f8aecce9887d013aed928"
            },
            "downloads": -1,
            "filename": "folium_vectorgrid-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "c72210ec6f020573a09a792377a84287",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 4615,
            "upload_time": "2024-07-01T19:29:58",
            "upload_time_iso_8601": "2024-07-01T19:29:58.626832Z",
            "url": "https://files.pythonhosted.org/packages/1b/c2/7a59cc97fe0d6428a386f4350104e35e25ea0f9bf89ee9d6465f76ee87be/folium_vectorgrid-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-01 19:29:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "folium-vectorgrid"
}
        
Elapsed time: 0.82506s