9 Commits
v0.1.7 ... v0.2

6 changed files with 34 additions and 56 deletions

View File

@@ -1,47 +1,36 @@
# prettymaps
A minimal Python library to draw customized maps from [OpenStreetMap](https://www.openstreetmap.org/#map=12/11.0733/106.3078) created using the [osmnx](https://github.com/gboeing/osmnx), [matplotlib](https://matplotlib.org/), [shapely](https://shapely.readthedocs.io/en/stable/index.html) and [vsketch](https://github.com/abey79/vsketch) packages.
A Python package to draw maps with customizable styles from [OpenStreetMap](https://www.openstreetmap.org/#map=12/11.0733/106.3078) data. Created using the [osmnx](https://github.com/gboeing/osmnx), [matplotlib](https://matplotlib.org/), [shapely](https://shapely.readthedocs.io/en/stable/index.html) and [vsketch](https://github.com/abey79/vsketch) packages.
> **This work is [licensed](LICENSE) under a GNU Affero General Public License v3.0 (you can make commercial use, distribute and modify this project, but must **disclose** the source code with the license and copyright notice)**
<a href='https://ko-fi.com/marceloprates_' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
# Installation
### Install using with [pip](https://pypi.org):
```
pip install prettymaps
```
# [Google Colab Demo](https://colab.research.google.com/github/marceloprates/prettymaps/blob/master/notebooks/examples.ipynb)
![](https://github.com/marceloprates/prettymaps/raw/main/prints/heerhugowaard.png)
This work is [licensed](LICENSE) under a GNU Affero General Public License v3.0 (you can make commercial use, distribute and modify this project, but must **disclose** the source code with the license and copyright notice)
## Note about crediting and NFTs:
# Note about crediting and NFTs:
- Please keep the printed message on the figures crediting my repository and OpenStreetMap ([mandatory by their license](https://www.openstreetmap.org/copyright)).
- I am personally **against** NFTs for their [environmental impact](https://earth.org/nfts-environmental-impact/), the fact that they're a [giant money-laundering pyramid scheme](https://twitter.com/smdiehl/status/1445795667826208770) and the structural incentives they create for [theft](https://twitter.com/NFTtheft) in the open source and generative art communities.
- **I do not authorize in any way this project to be used for selling NFTs**, although I cannot legally enforce it. **Respect the creator**.
- The [AeternaCivitas](https://magiceden.io/marketplace/aeterna_civitas) and [geoartnft](https://www.geo-nft.com/) projects have used this work to sell NFTs and refused to credit it. See how they reacted after being exposed: [AeternaCivitas](etc/NFT_theft_AeternaCivitas.jpg), [geoartnft](etc/NFT_theft_geoart.jpg).
- **I have closed my other generative art projects on Github and won't be sharing new ones as open source to protect me from the NFT community**.
<a href='https://ko-fi.com/marceloprates_' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
## As seen on [Hacker News](https://web.archive.org/web/20210825160918/https://news.ycombinator.com/news):
# As seen on [Hacker News](https://web.archive.org/web/20210825160918/https://news.ycombinator.com/news):
![](https://github.com/marceloprates/prettymaps/raw/main/prints/hackernews-prettymaps.png)
## [prettymaps subreddit](https://www.reddit.com/r/prettymaps_/)
## [Google Colaboratory Demo](https://colab.research.google.com/github/marceloprates/prettymaps/blob/master/notebooks/examples.ipynb)
# [prettymaps subreddit](https://www.reddit.com/r/prettymaps_/)
# Installation
OBS. I'm trying to solve a dependency issue with [vsketch](https://vsketch.readthedocs.io/en/latest/install.html) before publishing prettymaps v0.1.3, so, for now, please install directly from GitHub.
### Install locally:
Install prettymaps with:
```
pip install git+https://github.com/marceloprates/prettymaps
```
### Install on Google Colaboratory:
Install prettymaps with:
```
!pip install -e "git+https://github.com/marceloprates/prettymaps#egg=prettymaps"
```
Then **restart the runtime** (Runtime -> Restart Runtime) before importing prettymaps
# Tutorial

View File

@@ -6,12 +6,8 @@
"metadata": {},
"outputs": [],
"source": [
"# Instructions for Google Colab:\n",
"# 1. Uncomment the following line\n",
"# 2. Run it\n",
"# 3. Restart runtime (Runtime -> Restart runtime)\n",
"# 4. Comment it again\n",
"#!pip install -e \"git+https://github.com/marceloprates/prettymaps#egg=prettymaps\""
"# Install prettymaps using pip:\n",
"!pip install prettymaps"
]
},
{
@@ -1577,7 +1573,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.10.9 (main, Jan 11 2023, 15:21:40) [GCC 11.2.0]"
},
"orig_nbformat": 4,
"vscode": {

View File

@@ -20,7 +20,7 @@ import re
import os
import json
import yaml
import IPython
#import IPython
import pathlib
import warnings
import matplotlib
@@ -37,8 +37,8 @@ from matplotlib import pyplot as plt
from matplotlib.colors import hex2color
from matplotlib.patches import Path, PathPatch
from typing import Optional, Union, Tuple, List, Dict, Any, Iterable
from shapely.geometry import Point, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, box
from shapely.geometry.base import BaseGeometry
from shapely.geometry import Point, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, box
#import vsketch
@@ -78,6 +78,7 @@ class Preset:
"""
params: dict
'''
def _ipython_display_(self):
"""
Implements the _ipython_display_() function for the Preset class.
@@ -104,7 +105,7 @@ class Preset:
params.iloc[1:, 2:] = ''
IPython.display.display(IPython.display.Markdown(params.to_markdown()))
'''
def transform_gdfs(
gdfs: Dict[str, gp.GeoDataFrame],

View File

@@ -16,19 +16,11 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from ast import Dict
from functools import reduce
from tokenize import Number, String
from typing import Optional, Union, Tuple
# from unittest.runner import _ResultClassType
from xmlrpc.client import Boolean
import re
import osmnx as ox
from osmnx import utils_geo
from osmnx._errors import EmptyOverpassResponse
import warnings
import numpy as np
import osmnx as ox
from copy import deepcopy
from shapely.geometry import (
box,
Point,
@@ -37,12 +29,10 @@ from shapely.geometry import (
LineString,
MultiLineString,
)
from geopandas import GeoDataFrame
from shapely.affinity import rotate
from shapely.ops import unary_union
from geopandas import GeoDataFrame, read_file
import warnings
from shapely.errors import ShapelyDeprecationWarning
from copy import deepcopy
# Parse query (by coordinates, OSMId or name)

View File

@@ -1 +1,3 @@
osmnx==1.1.2
osmnx==1.2.2
Shapely>=1.8,<2.0
pyyaml==6.0.0

View File

@@ -7,7 +7,7 @@ presets_dir = os.path.abspath(os.path.join(os.path.pardir, 'presets'))
setup(
name="prettymaps",
version="v0.1.7",
version="v0.2-beta.3",
description="A simple python library to draw pretty maps from OpenStreetMap data",
long_description=parent_dir.joinpath("README.md").read_text(),
long_description_content_type="text/markdown",
@@ -22,6 +22,6 @@ setup(
classifiers=[
"Intended Audience :: Science/Research",
],
package_dir={'prettymaps': '.'},
package_dir={'prettymaps': 'prettymaps'},
package_data={'prettymaps': ['presets/*.json']},
)