folium-vectortilelayer


Namefolium-vectortilelayer JSON
Version 0.2.4 PyPI version JSON
download
home_pageNone
SummaryVectorTileLayer plugin for folium
upload_time2024-07-01 19:30:32
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-VectorTileLayer</h3>

  <p align="center">
    VectorTileLayer plugin for Folium
    <br />
    <a href="https://github.com/iwpnd/folium-vectortilelayer/issues">Report Bug</a>
    ยท
    <a href="https://github.com/iwpnd/folium-vectortilelayer/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

Follow up on [folium-vectorgrid](https://github.com/iwpnd/folium-vectorgrid) that wraps
[Leaflet.VectorTileLayer](https://gitlab.com/jkuebart/Leaflet.VectorTileLayer) to render
Mapbox vector tiles in folium maps.

Other than [Leaflet.VectorGrid](https://github.com/Leaflet/Leaflet.VectorGrid/), [Leaflet.VectorTileLayer](https://gitlab.com/jkuebart/Leaflet.VectorTileLayer) allows
to "overzoom" and "underzoom".
Even if the tiling provider only provides map tiles for zoom level 5 through 12,
[Leaflet.VectorTileLayer](https://gitlab.com/jkuebart/Leaflet.VectorTileLayer) utilizes
data from these upper and lower bounds to render tiles beyond
zoom level 12 and 5 respectively.

### Built With

-   [folium](https://github.com/python-visualization/folium)
-   [Leaflet.VectorTileLayer](https://gitlab.com/jkuebart/Leaflet.VectorTileLayer)

<!-- GETTING STARTED -->

## Getting Started

### Prerequisite

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

### Installation

#### as dependency

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

```
pip install folium-vectortilelayer
```

#### local development

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

## Usage

```python
from folium_vectortilelayer import VectorTileLayer
import folium

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

m = folium.Map()
options = {
    "layers": ["my_layer"], # define layer to be shown
    # min zoom of your map,
    # if minZoom < minDetailZoom features in minDetailZoom level are used
    # for minDetailZoom to minZoom
    "minZoom": 8,
    # max zoom of your map,
    # if maxZoom > maxDetailZoom features in maxDetailZoom level are used
    # for maxDetailZoom to maxZoom
    "maxZoom": 18,
    # min zoom level provided by source
    "minDetailZoom": 10,
    # max zoom level provided by source
    "maxDetailZoom": 13,
    "vectorTileLayerStyles": {
        "my_layer":{
            "fill": True,
            "weight": 1,
            "fillColor": 'green',
            "color": 'black',
            "fillOpacity":0.6,
            "opacity":0.6
        },
    }
}

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

Or with conditional styling

```python
import folium
from folium_vectortilelayer import VectorTileLayer

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

options = '''{
  "layers": ["my_layer"],
  "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
        };
      }
    }
  }
}'''

VectorTileLayer(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-vectortilelayer)


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "folium-vectortilelayer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Benjamin Ramser",
    "author_email": "iwpdn@posteo.de",
    "download_url": "https://files.pythonhosted.org/packages/8e/b2/a47b7f844601c241873620a9d265138d211b2255e387a1c32a9f4dfd70ea/folium_vectortilelayer-0.2.4.tar.gz",
    "platform": null,
    "description": "<br />\n<p align=\"center\">\n  <h3 align=\"center\">Folium-VectorTileLayer</h3>\n\n  <p align=\"center\">\n    VectorTileLayer plugin for Folium\n    <br />\n    <a href=\"https://github.com/iwpnd/folium-vectortilelayer/issues\">Report Bug</a>\n    \u00b7\n    <a href=\"https://github.com/iwpnd/folium-vectortilelayer/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\nFollow up on [folium-vectorgrid](https://github.com/iwpnd/folium-vectorgrid) that wraps\n[Leaflet.VectorTileLayer](https://gitlab.com/jkuebart/Leaflet.VectorTileLayer) to render\nMapbox vector tiles in folium maps.\n\nOther than [Leaflet.VectorGrid](https://github.com/Leaflet/Leaflet.VectorGrid/), [Leaflet.VectorTileLayer](https://gitlab.com/jkuebart/Leaflet.VectorTileLayer) allows\nto \"overzoom\" and \"underzoom\".\nEven if the tiling provider only provides map tiles for zoom level 5 through 12,\n[Leaflet.VectorTileLayer](https://gitlab.com/jkuebart/Leaflet.VectorTileLayer) utilizes\ndata from these upper and lower bounds to render tiles beyond\nzoom level 12 and 5 respectively.\n\n### Built With\n\n-   [folium](https://github.com/python-visualization/folium)\n-   [Leaflet.VectorTileLayer](https://gitlab.com/jkuebart/Leaflet.VectorTileLayer)\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-vectortilelayer.git\n```\n\n```\npip install folium-vectortilelayer\n```\n\n#### local development\n\n1. Clone and install\n    ```sh\n    git clone https://github.com/iwpnd/folium-vectortilelayer.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_vectortilelayer import VectorTileLayer\nimport folium\n\nurl = \"https://free.tilehosting.com/data/v3/{z}/{x}/{y}.pbf?token=my_token\"\n\nm = folium.Map()\noptions = {\n    \"layers\": [\"my_layer\"], # define layer to be shown\n    # min zoom of your map,\n    # if minZoom < minDetailZoom features in minDetailZoom level are used\n    # for minDetailZoom to minZoom\n    \"minZoom\": 8,\n    # max zoom of your map,\n    # if maxZoom > maxDetailZoom features in maxDetailZoom level are used\n    # for maxDetailZoom to maxZoom\n    \"maxZoom\": 18,\n    # min zoom level provided by source\n    \"minDetailZoom\": 10,\n    # max zoom level provided by source\n    \"maxDetailZoom\": 13,\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 = VectorTileLayer(url, \"folium_layer_name\", options)\nm.add_child(vc)\nm\n```\n\nOr with conditional styling\n\n```python\nimport folium\nfrom folium_vectortilelayer import VectorTileLayer\n\nm = folium.Map()\nurl = \"https://free.tilehosting.com/data/v3/{z}/{x}/{y}.pbf?token=my_token\"\n\noptions = '''{\n  \"layers\": [\"my_layer\"],\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\nVectorTileLayer(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-vectortilelayer)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "VectorTileLayer plugin for folium",
    "version": "0.2.4",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ca5fc22c9a65e9a7a872cd2224cfce1c7d319087543d5422c3b2a75d2ce58a53",
                "md5": "369b02884263a17dd1f03bc85d9d87d0",
                "sha256": "33f177c44112ca5ebf0a5022488c528e86d5be1d04916ed09a321ec241cd8d4d"
            },
            "downloads": -1,
            "filename": "folium_vectortilelayer-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "369b02884263a17dd1f03bc85d9d87d0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 5614,
            "upload_time": "2024-07-01T19:30:31",
            "upload_time_iso_8601": "2024-07-01T19:30:31.251349Z",
            "url": "https://files.pythonhosted.org/packages/ca/5f/c22c9a65e9a7a872cd2224cfce1c7d319087543d5422c3b2a75d2ce58a53/folium_vectortilelayer-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8eb2a47b7f844601c241873620a9d265138d211b2255e387a1c32a9f4dfd70ea",
                "md5": "ad690aa84c9bf64889fc87e561473f16",
                "sha256": "5d9ceb4f399fa36ee193c168dc56e130fc77e374bd0a56fc3d2f8892cdf960ee"
            },
            "downloads": -1,
            "filename": "folium_vectortilelayer-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "ad690aa84c9bf64889fc87e561473f16",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 5283,
            "upload_time": "2024-07-01T19:30:32",
            "upload_time_iso_8601": "2024-07-01T19:30:32.223341Z",
            "url": "https://files.pythonhosted.org/packages/8e/b2/a47b7f844601c241873620a9d265138d211b2255e387a1c32a9f4dfd70ea/folium_vectortilelayer-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-01 19:30:32",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "folium-vectortilelayer"
}
        
Elapsed time: 0.28277s