From 10d396065d81f8c67d70bfa04deecbaea994fa37 Mon Sep 17 00:00:00 2001 From: marceloprates Date: Tue, 8 Nov 2022 09:36:22 -0300 Subject: [PATCH] Fixed missing import (pyyaml) and supressed vsketch features due to difficulties in making setup.py install vsketch automatically --- presets/barcelona-plotter.json | 43 +++++++++++ presets/barcelona.json | 1 + presets/cb-bf-f.json | 96 ++++++++++++++++++++++++ presets/default.json | 129 ++++++++++++++++++++++++++++++++ presets/heerhugowaard.json | 130 +++++++++++++++++++++++++++++++++ presets/macao.json | 118 ++++++++++++++++++++++++++++++ presets/minimal.json | 44 +++++++++++ presets/tijuca.json | 1 + prettymaps/draw.py | 7 +- requirements.txt | 3 +- 10 files changed, 569 insertions(+), 3 deletions(-) create mode 100644 presets/barcelona-plotter.json create mode 100644 presets/barcelona.json create mode 100644 presets/cb-bf-f.json create mode 100644 presets/default.json create mode 100644 presets/heerhugowaard.json create mode 100644 presets/macao.json create mode 100644 presets/minimal.json create mode 100644 presets/tijuca.json diff --git a/presets/barcelona-plotter.json b/presets/barcelona-plotter.json new file mode 100644 index 0000000..55b1462 --- /dev/null +++ b/presets/barcelona-plotter.json @@ -0,0 +1,43 @@ +{ + "layers": { + "streets": { + "width": { + "primary": 5, + "secondary": 4, + "tertiary": 3, + "residential": 2, + "footway": 1 + } + }, + "building": { + "tags": { + "building": true + } + }, + "green": { + "tags": { + "landuse": [ + "grass", + "village_green" + ], + "leisure": "park" + } + } + }, + "style": { + "perimeter": { + "draw": false + }, + "streets": { + "stroke": 1, + "fill": 1, + "penWidth": 2 + }, + "buildings": { + "stroke": 2 + } + }, + "circle": null, + "radius": 500, + "dilate": 100 +} \ No newline at end of file diff --git a/presets/barcelona.json b/presets/barcelona.json new file mode 100644 index 0000000..34b8f15 --- /dev/null +++ b/presets/barcelona.json @@ -0,0 +1 @@ +{"layers": {"perimeter": {"circle": false}, "streets": {"width": {"primary": 5, "secondary": 4, "tertiary": 3, "residential": 2, "footway": 1}}, "building": {"tags": {"building": true}}, "green": {"tags": {"landuse": ["grass", "village_green"], "leisure": "park"}}}, "style": {"background": {"fc": "#F2F4CB", "ec": "#dadbc1", "hatch": "ooo...", "zorder": -1}, "perimeter": {"fill": false, "lw": 0, "zorder": 0}, "green": {"fc": "#8BB174", "ec": "#2F3737", "hatch_c": "#A7C497", "hatch": "ooo...", "lw": 1, "zorder": 1}, "water": {"fc": "#a8e1e6", "ec": "#2F3737", "hatch_c": "#9bc3d4", "hatch": "ooo...", "lw": 1, "zorder": 3}, "streets": {"fc": "#2F3737", "ec": "#475657", "alpha": 1, "lw": 0, "zorder": 4}, "building": {"palette": ["#433633", "#FF5E5B"], "ec": "#2F3737", "lw": 0.5, "zorder": 5}}, "circle": null, "radius": 500, "dilate": 100} \ No newline at end of file diff --git a/presets/cb-bf-f.json b/presets/cb-bf-f.json new file mode 100644 index 0000000..d656cab --- /dev/null +++ b/presets/cb-bf-f.json @@ -0,0 +1,96 @@ +{ + "layers": { + "streets": { + "width": { + "trunk": 6, + "primary": 6, + "secondary": 5, + "tertiary": 4, + "residential": 3.5, + "pedestrian": 3, + "footway": 3, + "path": 3 + } + }, + "building": { + "tags": { + "building": true, + "leisure": [ + "track", + "pitch" + ] + } + }, + "water": { + "tags": { + "natural": [ + "water", + "bay" + ] + } + }, + "park": { + "tags": { + "leisure": "park" + } + }, + "forest": { + "tags": { + "landuse": "forest" + } + }, + "garden": { + "tags": { + "leisure": "garden" + } + } + }, + "style": { + "perimeter": { + "fill": false, + "lw": 0, + "zorder": 0 + }, + "park": { + "fc": "#AABD8C", + "ec": "#87996b", + "lw": 1, + "zorder": 1 + }, + "forest": { + "fc": "#78A58D", + "ec": "#658a76", + "lw": 1, + "zorder": 1 + }, + "garden": { + "fc": "#a9d1a9", + "ec": "#8ab58a", + "lw": 1, + "zorder": 1 + }, + "water": { + "fc": "#92D5F2", + "ec": "#6da8c2", + "lw": 1, + "zorder": 2 + }, + "streets": { + "fc": "#F1E6D0", + "ec": "#2F3737", + "lw": 1.5, + "zorder": 3 + }, + "building": { + "palette": [ + "#fff" + ], + "ec": "#2F3737", + "lw": 1, + "zorder": 4 + } + }, + "circle": null, + "radius": null, + "dilate": 0 +} \ No newline at end of file diff --git a/presets/default.json b/presets/default.json new file mode 100644 index 0000000..2a555d0 --- /dev/null +++ b/presets/default.json @@ -0,0 +1,129 @@ +{ + "layers": { + "perimeter": {}, + "streets": { + "width": { + "motorway": 5, + "trunk": 5, + "primary": 4.5, + "secondary": 4, + "tertiary": 3.5, + "cycleway": 3.5, + "residential": 3, + "service": 2, + "unclassified": 2, + "pedestrian": 2, + "footway": 1 + } + }, + "building": { + "tags": { + "building": true, + "landuse": "construction" + } + }, + "water": { + "tags": { + "natural": [ + "water", + "bay" + ] + } + }, + "forest": { + "tags": { + "landuse": "forest" + } + }, + "green": { + "tags": { + "landuse": [ + "grass", + "orchard" + ], + "natural": [ + "island", + "wood" + ], + "leisure": "park" + } + }, + "beach": { + "tags": { + "natural": "beach" + } + }, + "parking": { + "tags": { + "amenity": "parking", + "highway": "pedestrian", + "man_made": "pier" + } + } + }, + "style": { + "perimeter": { + "fill": false, + "lw": 0, + "zorder": 0 + }, + "background": { + "fc": "#F2F4CB", + "zorder": -1 + }, + "green": { + "fc": "#8BB174", + "ec": "#2F3737", + "hatch_c": "#A7C497", + "hatch": "ooo...", + "lw": 1, + "zorder": 1 + }, + "forest": { + "fc": "#64B96A", + "ec": "#2F3737", + "lw": 1, + "zorder": 2 + }, + "water": { + "fc": "#a8e1e6", + "ec": "#2F3737", + "hatch_c": "#9bc3d4", + "hatch": "ooo...", + "lw": 1, + "zorder": 3 + }, + "beach": { + "fc": "#FCE19C", + "ec": "#2F3737", + "hatch_c": "#d4d196", + "hatch": "ooo...", + "lw": 1, + "zorder": 3 + }, + "parking": { + "fc": "#F2F4CB", + "ec": "#2F3737", + "lw": 1, + "zorder": 3 + }, + "streets": { + "fc": "#2F3737", + "ec": "#475657", + "alpha": 1, + "lw": 0, + "zorder": 4 + }, + "building": { + "palette": [ + "#433633", + "#FF5E5B" + ], + "ec": "#2F3737", + "lw": 0.5, + "zorder": 5 + } + }, + "circle": null, + "radius": 500 +} \ No newline at end of file diff --git a/presets/heerhugowaard.json b/presets/heerhugowaard.json new file mode 100644 index 0000000..df71591 --- /dev/null +++ b/presets/heerhugowaard.json @@ -0,0 +1,130 @@ +{ + "layers": { + "perimeter": {}, + "streets": { + "width": { + "motorway": 5, + "trunk": 5, + "primary": 4.5, + "secondary": 4, + "tertiary": 3.5, + "cycleway": 3.5, + "residential": 3, + "service": 2, + "unclassified": 2, + "pedestrian": 2, + "footway": 1 + } + }, + "building": { + "tags": { + "building": true, + "landuse": "construction" + } + }, + "water": { + "tags": { + "natural": [ + "water", + "bay" + ] + } + }, + "forest": { + "tags": { + "landuse": "forest" + } + }, + "green": { + "tags": { + "landuse": [ + "grass", + "orchard" + ], + "natural": [ + "island", + "wood" + ], + "leisure": "park" + } + }, + "beach": { + "tags": { + "natural": "beach" + } + }, + "parking": { + "tags": { + "amenity": "parking", + "highway": "pedestrian", + "man_made": "pier" + } + } + }, + "style": { + "perimeter": { + "fill": false, + "lw": 0, + "zorder": 0 + }, + "background": { + "fc": "#F2F4CB", + "zorder": -1 + }, + "green": { + "fc": "#8BB174", + "ec": "#2F3737", + "hatch_c": "#A7C497", + "hatch": "ooo...", + "lw": 1, + "zorder": 1 + }, + "forest": { + "fc": "#64B96A", + "ec": "#2F3737", + "lw": 1, + "zorder": 2 + }, + "water": { + "fc": "#a8e1e6", + "ec": "#2F3737", + "hatch_c": "#9bc3d4", + "hatch": "ooo...", + "lw": 1, + "zorder": 3 + }, + "beach": { + "fc": "#FCE19C", + "ec": "#2F3737", + "hatch_c": "#d4d196", + "hatch": "ooo...", + "lw": 1, + "zorder": 3 + }, + "parking": { + "fc": "#F2F4CB", + "ec": "#2F3737", + "lw": 1, + "zorder": 3 + }, + "streets": { + "fc": "#2F3737", + "ec": "#475657", + "alpha": 1, + "lw": 0, + "zorder": 4 + }, + "building": { + "palette": [ + "#433633", + "#FF5E5B" + ], + "ec": "#2F3737", + "lw": 0.5, + "zorder": 5 + } + }, + "circle": null, + "radius": 800, + "dilate": 100 +} \ No newline at end of file diff --git a/presets/macao.json b/presets/macao.json new file mode 100644 index 0000000..98d6c3e --- /dev/null +++ b/presets/macao.json @@ -0,0 +1,118 @@ +{ + "layers": { + "perimeter": {}, + "streets": { + "custom_filter": "[\"highway\"~\"motorway|trunk|primary|secondary|tertiary|residential|service|unclassified|pedestrian|footway\"]", + "width": { + "motorway": 5, + "trunk": 5, + "primary": 4.5, + "secondary": 4, + "tertiary": 3.5, + "residential": 3, + "service": 2, + "unclassified": 2, + "pedestrian": 2, + "footway": 1 + } + }, + "building": { + "tags": { + "building": true, + "landuse": "construction" + }, + "union": false + }, + "water": { + "tags": { + "natural": [ + "water", + "bay" + ] + } + }, + "green": { + "tags": { + "landuse": "grass", + "natural": [ + "island", + "wood" + ], + "leisure": "park" + } + }, + "forest": { + "tags": { + "landuse": "forest" + } + }, + "parking": { + "tags": { + "amenity": "parking", + "highway": "pedestrian", + "man_made": "pier" + } + } + }, + "style": { + "background": { + "fc": "#F2F4CB", + "ec": "#dadbc1", + "hatch": "ooo...", + "zorder": -1 + }, + "perimeter": { + "fc": "#F2F4CB", + "ec": "#dadbc1", + "lw": 0, + "hatch": "ooo...", + "zorder": 0 + }, + "green": { + "fc": "#D0F1BF", + "ec": "#2F3737", + "lw": 1, + "zorder": 1 + }, + "forest": { + "fc": "#64B96A", + "ec": "#2F3737", + "lw": 1, + "zorder": 1 + }, + "water": { + "fc": "#a1e3ff", + "ec": "#2F3737", + "hatch": "ooo...", + "hatch_c": "#85c9e6", + "lw": 1, + "zorder": 2 + }, + "parking": { + "fc": "#F2F4CB", + "ec": "#2F3737", + "lw": 1, + "zorder": 3 + }, + "streets": { + "fc": "#2F3737", + "ec": "#475657", + "alpha": 1, + "lw": 0, + "zorder": 3 + }, + "building": { + "palette": [ + "#FFC857", + "#E9724C", + "#C5283D" + ], + "ec": "#2F3737", + "lw": 0.5, + "zorder": 4 + } + }, + "circle": true, + "radius": 1100, + "dilate": 0 +} \ No newline at end of file diff --git a/presets/minimal.json b/presets/minimal.json new file mode 100644 index 0000000..2d21eb1 --- /dev/null +++ b/presets/minimal.json @@ -0,0 +1,44 @@ +{ + "layers": { + "perimeter": {}, + "streets": { + "width": { + "motorway": 5, + "trunk": 5, + "primary": 4, + "secondary": 3, + "tertiary": 2, + "residential": 2 + } + }, + "building": { + "tags": { + "building": true + } + } + }, + "style": { + "perimeter": { + "fill": false, + "lw": 0, + "zorder": 0 + }, + "background": { + "fc": "#fff", + "zorder": -1 + }, + "streets": { + "fc": "#000", + "lw": 0, + "zorder": 4 + }, + "building": { + "fc": "#fff", + "ec": "#000", + "lw": 0.5, + "zorder": 5 + } + }, + "circle": null, + "radius": 400 +} \ No newline at end of file diff --git a/presets/tijuca.json b/presets/tijuca.json new file mode 100644 index 0000000..051bbe9 --- /dev/null +++ b/presets/tijuca.json @@ -0,0 +1 @@ +{"layers": {"perimeter": {}, "streets": {"width": {"motorway": 12, "trunk": 12, "primary": 11, "secondary": 10, "tertiary": 9, "residential": 8}}, "park": {"tags": {"leisure": "nature_reserve", "landuse": "military", "boundary": "protected_area", "place": "square", "natural": "grassland", "amenity": "hospital"}}, "grass": {"tags": {"landuse": "grass", "natural": "wood"}}, "wetland": {"tags": {"natural": "scrub"}}, "beach": {"tags": {"natural": "beach"}}, "water": {"tags": {"natural": "water"}}, "pedestrian": {"tags": {"area:highway": "pedestrian"}}, "building": {"tags": {"building": true}}}, "style": {"perimeter": {"ec": "#0F110C", "fill": false, "lw": 0}, "park": {"fc": "#AAD897", "ec": "#8bc49e", "lw": 0, "zorder": 1, "hatch": "ooo..."}, "grass": {"fc": "#72C07A", "ec": "#64a38d", "lw": 0, "zorder": 1, "hatch": "ooo..."}, "wetland": {"fc": "#D2D68D", "ec": "#AEB441", "lw": 0, "zorder": 3, "hatch": "ooo..."}, "water": {"fc": "#6CCFF6", "ec": "#59adcf", "lw": 0, "zorder": 2, "hatch": "ooo..."}, "beach": {"fc": "#F2E3BC", "ec": "#EBD499", "lw": 0, "zorder": 2, "hatch": "ooo..."}, "pedestrian": {"fc": "#7BC950", "ec": "#638475", "lw": 0, "zorder": 2, "hatch": "ooo..."}, "streets": {"fc": "#898989", "ec": "#706f6f", "zorder": 3, "lw": 0, "hatch": "ooo..."}, "building": {"fc": "#E7A89C", "ec": "#E7A89C", "lw": 0, "zorder": 0}}, "circle": null, "radius": null, "dilate": 0} \ No newline at end of file diff --git a/prettymaps/draw.py b/prettymaps/draw.py index 55fd6bc..e931b16 100644 --- a/prettymaps/draw.py +++ b/prettymaps/draw.py @@ -22,7 +22,7 @@ import re import os import json import yaml -import vsketch +#import vsketch import IPython import warnings import matplotlib @@ -192,7 +192,8 @@ def plot_gdf( gdf: gp.GeoDataFrame, ax: matplotlib.axes.Axes, mode: str = 'matplotlib', - vsk: Optional[vsketch.SketchClass] = None, + #vsk: Optional[vsketch.SketchClass] = None, + vsk=None, palette: Optional[List[str]] = None, width: Optional[Union[dict, float]] = None, union: bool = False, @@ -925,6 +926,7 @@ def plot( # 8. Draw layers if mode == "plotter": # 8.1. Draw layers in plotter (vsketch) mode + ''' class Sketch(vsketch.SketchClass): def draw(self, vsk: vsketch.Vsketch): @@ -953,6 +955,7 @@ def plot( sketch = Sketch() sketch.display() + ''' elif mode == "matplotlib": # 8.2. Draw layers in matplotlib mode for layer in gdfs: diff --git a/requirements.txt b/requirements.txt index ecaeef8..ee5f398 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,5 @@ osmnx==1.2.1 tabulate==0.8.9 Shapely>=1.8,<2.0 descartes==1.1.0 -ipykernel==6.15.1 \ No newline at end of file +ipykernel==6.15.1 +pyyaml==6.0.0 \ No newline at end of file