folium-vectortilelayer


Namefolium-vectortilelayer JSON
Version 0.2.3 PyPI version JSON
download
home_page
SummaryVectorTileLayer plugin for folium
upload_time2024-03-10 11:34:18
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-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": "",
    "name": "folium-vectortilelayer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Benjamin Ramser",
    "author_email": "iwpdn@posteo.de",
    "download_url": "https://files.pythonhosted.org/packages/33/c6/b855e392e11886516284fe9a18c2425189185b6f721112007b5ed717c6f2/folium_vectortilelayer-0.2.3.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.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "703f65c067a6f4a9a96f46b29233628dc24b4d267e37d13fbffaf6309c639116",
                "md5": "ce8c62ff454430f2ea9ea7350b6e5756",
                "sha256": "624f8b547def7a4e33978fba2915510ad0b1522f611c5c1ba057d239820bb6bb"
            },
            "downloads": -1,
            "filename": "folium_vectortilelayer-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ce8c62ff454430f2ea9ea7350b6e5756",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 5616,
            "upload_time": "2024-03-10T11:34:16",
            "upload_time_iso_8601": "2024-03-10T11:34:16.692205Z",
            "url": "https://files.pythonhosted.org/packages/70/3f/65c067a6f4a9a96f46b29233628dc24b4d267e37d13fbffaf6309c639116/folium_vectortilelayer-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33c6b855e392e11886516284fe9a18c2425189185b6f721112007b5ed717c6f2",
                "md5": "cd4168cf7c1354710956d3f357eb0e62",
                "sha256": "09b8f6df1b4ffb00071b5425a5b854c23878afddad701dc5bf799738722050e0"
            },
            "downloads": -1,
            "filename": "folium_vectortilelayer-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "cd4168cf7c1354710956d3f357eb0e62",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 5291,
            "upload_time": "2024-03-10T11:34:18",
            "upload_time_iso_8601": "2024-03-10T11:34:18.346694Z",
            "url": "https://files.pythonhosted.org/packages/33/c6/b855e392e11886516284fe9a18c2425189185b6f721112007b5ed717c6f2/folium_vectortilelayer-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-10 11:34:18",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "folium-vectortilelayer"
}
        
Elapsed time: 0.18350s