prettymapp


Nameprettymapp JSON
Version 0.4.0 PyPI version JSON
download
home_pageNone
SummaryCreate beautiful maps from OpenStreetMap data
upload_time2024-11-30 15:34:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT
keywords art map cartography osm streamlit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # prettymapp 🖼️

**Prettymapp is a webapp and Python package to create beautiful maps from OpenStreetMap data**

---
<h3 align="center">
    🎈 Try it out here: <a href="https://prettymapp.streamlit.app/">prettymapp on streamlit 🎈 </a>
</h3>

---



<p align="center">
    <a href="https://prettymapp.streamlit.app/"><img src="./streamlit-prettymapp/example_prints/demo.gif" width=700></a>
</p>

<br>

<table>
    <tr><td><img src="./streamlit-prettymapp/example_prints/macau.png"></td><td><img src="./streamlit-prettymapp/example_prints/barcelona.png"></td></tr>
</table>

## Based on the prettymaps project

Prettymapp is based on a rewrite of the fantastic [prettymaps](https://github.com/marceloprates/prettymaps) project by
[@marceloprates](https://github.com/marceloprates). All credit for the original idea, designs and implementation go to him.
The prettymapp rewrite focuses on speed and adapted configuration to interface with the webapp.
It drops more complex configuration options in favour of improved speed, reduced code complexity and 
simplified configuration interfaces. It is partially tested and adds a [streamlit](https://streamlit.io/) webapp component.

## Running the app locally

```bash
git clone https://github.com/chrieke/prettymapp.git
cd prettymapp
pip install -r streamlit-prettymapp/requirements.txt
streamlit run streamlit-prettymapp/app.py
```

## Python package

You can also use prettymapp without the webapp, directly in Python. This lets you customize the functionality or 
build your own application.

**Installation:**

```bash
pip install prettymapp
```

**Define the area, download and plot the OSM data:**

You can select from 4 [predefined styles](prettymapp/settings.py#L35): `Peach`, `Auburn`, `Citrus` and `Flannel`.

```python
from prettymapp.geo import get_aoi
from prettymapp.osm import get_osm_geometries
from prettymapp.plotting import Plot
from prettymapp.settings import STYLES

aoi = get_aoi(address="Praça Ferreira do Amaral, Macau", radius=1100, rectangular=False)
df = get_osm_geometries(aoi=aoi)

fig = Plot(
    df=df,
    aoi_bounds=aoi.bounds,
    draw_settings=STYLES["Peach"],
).plot_all()

fig.savefig("map.jpg")
```

You can also plot exported OSM XML files e.g. from openstreetmap.org:

```python
from prettymapp.osm import get_osm_geometries_from_xml

df = get_osm_geometries_from_xml(filepath="Berlin.osm")
aoi_bounds = df.total_bounds
...
```

**Customize styles & layers**

Edit the `draw_settings` input to create your own custom styles! The map layout can be further customized with the additional arguments of the [`Plot`](plotting.py#L36) class (e.g. `shape`, `contour_width` etc.). Check the webapp [examples](streamlit-prettymapp/examples.json) for inspiration.

```python
from prettymapp.settings import STYLES

custom_style = STYLES["Peach"].copy()
custom_style["urban"] = {
    "cmap": ["#3452eb"],
    "ec": "#E9724C",
    "lw": 0.2,
    "zorder": 4,
}

fig = Plot(
    df=df,
    aoi_bounds=aoi.bounds,
    draw_settings=custom_style,
    shape="circle",
    contour_width=0,
).plot_all()

```

You can also customize the selection of OSM landcover classes that should be displayed.

```python
from prettymapp.settings import LANDCOVER_CLASSES

custom_lc_classes = LANDCOVER_CLASSES.copy()
custom_lc_classes["urban"]["building"] = False

df = get_osm_geometries(aoi=aoi, landcover_classes=custom_lc_classes)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "prettymapp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "art, map, cartography, osm, streamlit",
    "author": null,
    "author_email": "Christoph Rieke <christoph.k.rieke@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b4/d2/4147bb120674a1450c7bafe9b86a246009025cc3c7a55dc1107e8682a410/prettymapp-0.4.0.tar.gz",
    "platform": null,
    "description": "# prettymapp \ud83d\uddbc\ufe0f\n\n**Prettymapp is a webapp and Python package to create beautiful maps from OpenStreetMap data**\n\n---\n<h3 align=\"center\">\n    \ud83c\udf88 Try it out here: <a href=\"https://prettymapp.streamlit.app/\">prettymapp on streamlit \ud83c\udf88 </a>\n</h3>\n\n---\n\n\n\n<p align=\"center\">\n    <a href=\"https://prettymapp.streamlit.app/\"><img src=\"./streamlit-prettymapp/example_prints/demo.gif\" width=700></a>\n</p>\n\n<br>\n\n<table>\n    <tr><td><img src=\"./streamlit-prettymapp/example_prints/macau.png\"></td><td><img src=\"./streamlit-prettymapp/example_prints/barcelona.png\"></td></tr>\n</table>\n\n## Based on the prettymaps project\n\nPrettymapp is based on a rewrite of the fantastic [prettymaps](https://github.com/marceloprates/prettymaps) project by\n[@marceloprates](https://github.com/marceloprates). All credit for the original idea, designs and implementation go to him.\nThe prettymapp rewrite focuses on speed and adapted configuration to interface with the webapp.\nIt drops more complex configuration options in favour of improved speed, reduced code complexity and \nsimplified configuration interfaces. It is partially tested and adds a [streamlit](https://streamlit.io/) webapp component.\n\n## Running the app locally\n\n```bash\ngit clone https://github.com/chrieke/prettymapp.git\ncd prettymapp\npip install -r streamlit-prettymapp/requirements.txt\nstreamlit run streamlit-prettymapp/app.py\n```\n\n## Python package\n\nYou can also use prettymapp without the webapp, directly in Python. This lets you customize the functionality or \nbuild your own application.\n\n**Installation:**\n\n```bash\npip install prettymapp\n```\n\n**Define the area, download and plot the OSM data:**\n\nYou can select from 4 [predefined styles](prettymapp/settings.py#L35): `Peach`, `Auburn`, `Citrus` and `Flannel`.\n\n```python\nfrom prettymapp.geo import get_aoi\nfrom prettymapp.osm import get_osm_geometries\nfrom prettymapp.plotting import Plot\nfrom prettymapp.settings import STYLES\n\naoi = get_aoi(address=\"Pra\u00e7a Ferreira do Amaral, Macau\", radius=1100, rectangular=False)\ndf = get_osm_geometries(aoi=aoi)\n\nfig = Plot(\n    df=df,\n    aoi_bounds=aoi.bounds,\n    draw_settings=STYLES[\"Peach\"],\n).plot_all()\n\nfig.savefig(\"map.jpg\")\n```\n\nYou can also plot exported OSM XML files e.g. from openstreetmap.org:\n\n```python\nfrom prettymapp.osm import get_osm_geometries_from_xml\n\ndf = get_osm_geometries_from_xml(filepath=\"Berlin.osm\")\naoi_bounds = df.total_bounds\n...\n```\n\n**Customize styles & layers**\n\nEdit the `draw_settings` input to create your own custom styles! The map layout can be further customized with the additional arguments of the [`Plot`](plotting.py#L36) class (e.g. `shape`, `contour_width` etc.). Check the webapp [examples](streamlit-prettymapp/examples.json) for inspiration.\n\n```python\nfrom prettymapp.settings import STYLES\n\ncustom_style = STYLES[\"Peach\"].copy()\ncustom_style[\"urban\"] = {\n    \"cmap\": [\"#3452eb\"],\n    \"ec\": \"#E9724C\",\n    \"lw\": 0.2,\n    \"zorder\": 4,\n}\n\nfig = Plot(\n    df=df,\n    aoi_bounds=aoi.bounds,\n    draw_settings=custom_style,\n    shape=\"circle\",\n    contour_width=0,\n).plot_all()\n\n```\n\nYou can also customize the selection of OSM landcover classes that should be displayed.\n\n```python\nfrom prettymapp.settings import LANDCOVER_CLASSES\n\ncustom_lc_classes = LANDCOVER_CLASSES.copy()\ncustom_lc_classes[\"urban\"][\"building\"] = False\n\ndf = get_osm_geometries(aoi=aoi, landcover_classes=custom_lc_classes)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Create beautiful maps from OpenStreetMap data",
    "version": "0.4.0",
    "project_urls": {
        "Changelog": "https://github.com/chrieke/prettymapp/changelog",
        "Homepage": "https://github.com/chrieke/prettymapp"
    },
    "split_keywords": [
        "art",
        " map",
        " cartography",
        " osm",
        " streamlit"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5a56250cd3099da90e06307cab47a69ea8a18b43f8b427e816986a9de670de9d",
                "md5": "48f591030c4ca973e18646ef6bc0e88c",
                "sha256": "10f2c41045159803e73c3d9132dc2c7a83a605e59e8a8cf6dc9d9516efc520f5"
            },
            "downloads": -1,
            "filename": "prettymapp-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "48f591030c4ca973e18646ef6bc0e88c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 53198,
            "upload_time": "2024-11-30T15:34:31",
            "upload_time_iso_8601": "2024-11-30T15:34:31.251679Z",
            "url": "https://files.pythonhosted.org/packages/5a/56/250cd3099da90e06307cab47a69ea8a18b43f8b427e816986a9de670de9d/prettymapp-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b4d24147bb120674a1450c7bafe9b86a246009025cc3c7a55dc1107e8682a410",
                "md5": "76d8d7f058cab49c734f0a582d0c74a5",
                "sha256": "a4596eec9de1a22d53e4df0a703c912ab2fce5296afc8ee9bf7f9a301190df8a"
            },
            "downloads": -1,
            "filename": "prettymapp-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "76d8d7f058cab49c734f0a582d0c74a5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 53617,
            "upload_time": "2024-11-30T15:34:49",
            "upload_time_iso_8601": "2024-11-30T15:34:49.049766Z",
            "url": "https://files.pythonhosted.org/packages/b4/d2/4147bb120674a1450c7bafe9b86a246009025cc3c7a55dc1107e8682a410/prettymapp-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-30 15:34:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "chrieke",
    "github_project": "prettymapp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "prettymapp"
}
        
Elapsed time: 0.35727s