mirror of
https://github.com/marceloprates/prettymaps.git
synced 2025-09-05 20:03:01 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
66c1bbf904 | ||
|
7d60660999 | ||
|
e8ecfe5e9e |
@@ -34,42 +34,10 @@ from shapely.geometry import box, Polygon, MultiLineString, GeometryCollection
|
||||
from shapely.affinity import translate, scale, rotate
|
||||
from descartes import PolygonPatch
|
||||
from tabulate import tabulate
|
||||
from IPython.display import Markdown, display
|
||||
|
||||
from .fetch import get_perimeter, get_layer
|
||||
|
||||
|
||||
# Helper functions
|
||||
def get_hash(key):
|
||||
return frozenset(key.items()) if type(key) == dict else key
|
||||
|
||||
|
||||
# Drawing functions
|
||||
def show_palette(palette, description=""):
|
||||
"""
|
||||
Helper to display palette in Markdown
|
||||
"""
|
||||
|
||||
colorboxes = [
|
||||
f"" for c in palette
|
||||
]
|
||||
|
||||
display(Markdown((description)))
|
||||
display(Markdown(tabulate(pd.DataFrame(colorboxes), showindex=False)))
|
||||
|
||||
|
||||
def get_patch(shape, **kwargs):
|
||||
"""
|
||||
Convert shapely object to matplotlib patch
|
||||
"""
|
||||
# if type(shape) == Path:
|
||||
# return patches.PathPatch(shape, **kwargs)
|
||||
if type(shape) == Polygon and shape.area > 0:
|
||||
return PolygonPatch(list(zip(*shape.exterior.xy)), **kwargs)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
# Plot a single shape
|
||||
def plot_shape(shape, ax, vsketch=None, **kwargs):
|
||||
"""
|
||||
|
@@ -1,4 +1,3 @@
|
||||
osmnx==1.0.1
|
||||
tabulate==0.8.9
|
||||
IPython==7.27.0
|
||||
#vsketch==1.0.0
|
||||
|
2
setup.py
2
setup.py
@@ -5,7 +5,7 @@ parent_dir = Path(__file__).resolve().parent
|
||||
|
||||
setup(
|
||||
name="prettymaps",
|
||||
version="1.0.0",
|
||||
version="v0.1.2",
|
||||
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",
|
||||
|
Reference in New Issue
Block a user