Skip to content

Commit aa5296c

Browse files
authored
Merge pull request #3 from gy-mate/patch-1
Extend install instructions; improve `make.sh`. I don't have Mac OSX so I'll trust you on that. The wording changes look fine. I'm trusting you on the minor tweaks to GM commands.
2 parents 9dc02ae + 3c24caf commit aa5296c

File tree

3 files changed

+41
-25
lines changed

3 files changed

+41
-25
lines changed

README.md

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,44 @@
1-
# Mapping before & after
1+
# Mapping party before–after
22

3-
Make a image of data of an area in OSM with data from 2 dates, showing what was changed before & after
3+
Make a image of OSM data of an area from 2 dates, showing what was changed.
44

55
## Installation
66

7-
This script uses [`nik4`](https://github.com/Zverik/Nik4) to generate an image with the [`openstreetmap-carto` map style](https://github.com/gravitystorm/openstreetmap-carto/)
8-
9-
Follow the [`openstreetmap-carto` installation instructions](https://github.com/gravitystorm/openstreetmap-carto/blob/master/INSTALL.md), first.
10-
11-
Install `nik4`.
12-
7+
1. *On macOS:* [install Homebrew](https://brew.sh/#:~:text=Install%20Homebrew)
8+
1. [Install `pipx`](https://pipx.pypa.io/stable/installation/#installing-pipx)
9+
1. [Install `openstreetmap-carto`](https://github.com/gravitystorm/openstreetmap-carto/blob/4ec2dc9391c411e124c78b3ba1aad9173fea20cb/INSTALL.md)
10+
1. Install [`osmium-tool`](https://github.com/osmcode/osmium-tool)
11+
1. [Install Mapnik](https://github.com/mapnik/mapnik/blob/master/INSTALL.md#source-build)
12+
1. [Install `python-mapnik`](https://github.com/mapnik/python-mapnik#building-from-source)
13+
1. Install [`nik4`](https://github.com/Zverik/Nik4) (used to generate an image with the [`openstreetmap-carto` map style](https://github.com/gravitystorm/openstreetmap-carto/)):
14+
```bash
15+
pipx install nik4
16+
```
17+
1. [Install GraphicsMagick](http://www.graphicsmagick.org/README.html#id4)
18+
1. *On macOS:* replace built-in `coreutils` commands with the GNU ones:
19+
```bash
20+
brew install coreutils
21+
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH
22+
```
23+
1. Clone this repo:
24+
```bash
25+
git clone --recurse-submodules https://github.com/amandasaurus/osm-mapping-party-before-after
26+
cd osm-mapping-party-before-after
27+
```
1328
1429
## Usage
1530
16-
First download an OSM history from, e.g. from [Geofabrik's Download service](https://osm-internal.download.geofabrik.de/). You will need to log in with an OSM account.
17-
18-
A `BBOX` can be can be calculated with [BBoxFinder.com](http://bboxfinder.com/).
19-
20-
The `BEFORE_TIME` & `AFTER_TIME` are ISO timestamps.
21-
22-
```
23-
./make.sh OSM_HISTORY_FILE.osh.pbf BEFORE_TIME AFTER_TIME BBOX MIN_ZOOM MAX_ZOOM
24-
```
25-
26-
## Example
31+
1. Download an OSM history file (`.osh.pbf`) e.g. from [Geofabrik's internal download server](https://osm-internal.download.geofabrik.de/?landing_page=true). You will need to log in with an OSM account.
32+
1. Calculate the `BBOX` with [BBoxFinder.com](http://bboxfinder.com/).
33+
1. *Draw a rectangle*
34+
1. Copy the *Box* value
35+
1. Run the following command:
36+
```bash
37+
./make.sh OSM_HISTORY_FILE.osh.pbf BEFORE_TIME AFTER_TIME BBOX MIN_ZOOM MAX_ZOOM
38+
```
39+
The `BEFORE_TIME` & `AFTER_TIME` are ISO 8601 timestamps.
40+
41+
## Example output
2742
2843
![Example](sample.png)
2944

make.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ fi
6767
if [ ! -s "$ROOT/openstreetmap-carto/node_modules/.bin/carto" ] ; then
6868
cd "$ROOT/openstreetmap-carto"
6969
echo "Installing carto into $ROOT/openstreetmap-carto/node_modules with npm..."
70+
npm init -y
7071
npm install carto -q
7172
fi
7273
if [ ! -s "$ROOT/openstreetmap-carto/project.xml" ] ; then
@@ -134,9 +135,9 @@ for ZOOM in $(seq "$MIN_ZOOM" "$MAX_ZOOM") ; do
134135
echo "Generating zoom ${ZOOM} level"
135136
nik4 openstreetmap-carto/project.xml "$PREFIX.$TIME_AFTER.$BBOX_COMMA.z${ZOOM}.png" -b $BBOX_SPACE -z "$ZOOM" || break
136137
NEW="$(mktemp tmp.XXXXXX.png)"
137-
gm convert "$PREFIX.$TIME_AFTER.$BBOX_COMMA.z${ZOOM}.png" -background white label:"$TIME_AFTER" -gravity center -append "$NEW"
138+
gm convert "$PREFIX.$TIME_AFTER.$BBOX_COMMA.z${ZOOM}.png" -background white -label "$TIME_AFTER" -gravity center -append "$NEW"
138139
mv "$NEW" "$PREFIX.$TIME_AFTER.$BBOX_COMMA.z${ZOOM}.png"
139-
gm convert "$PREFIX.$TIME_AFTER.$BBOX_COMMA.z${ZOOM}.png" -background white label:"Data © OpenStreetMap contributors, ODbL" -gravity center -append "$NEW"
140+
gm convert "$PREFIX.$TIME_AFTER.$BBOX_COMMA.z${ZOOM}.png" -background white -label "Data © OpenStreetMap contributors, ODbL" -gravity center -append "$NEW"
140141
mv "$NEW" "$PREFIX.$TIME_AFTER.$BBOX_COMMA.z${ZOOM}.png"
141142
fi
142143
done
@@ -153,12 +154,12 @@ for ZOOM in $(seq "$MIN_ZOOM" "$MAX_ZOOM") ; do
153154

154155
if [ "$BEFORE" -nt "$NEW_PNG" ] || [ "$AFTER" -nt "$NEW_PNG" ] ; then
155156
TMP="$(mktemp tmp.XXXXXX.png)"
156-
gm montage -geometry +0+0 "$BEFORE" "$AFTER" "$TMP"
157-
gm convert "$TMP" -background white label:"Data © OpenStreetMap contributors, ODbL" -gravity center -append "$NEW_PNG"
157+
gm montage -geometry +0+0 "$BEFORE" "$AFTER" "$TMP"
158+
gm convert "$TMP" -background white -label "Data © OpenStreetMap contributors, ODbL" -gravity center -append "$NEW_PNG"
158159
fi
159160

160161
if [ "$BEFORE" -nt "$NEW_PNG" ] || [ "$AFTER" -nt "$NEW_PNG" ] ; then
161-
gm montage -geometry +0+0 "$BEFORE" "$AFTER" "$NEW_PNG"
162+
gm montage -geometry +0+0 "$BEFORE" "$AFTER" "$NEW_PNG"
162163
fi
163164

164165
NEW_GIF="progress.$PREFIX.$TIME_BEFORE.$TIME_AFTER.$BBOX_COMMA.z${ZOOM}.gif"

openstreetmap-carto

Submodule openstreetmap-carto updated 668 files

0 commit comments

Comments
 (0)