Skip to content

Commit

Permalink
Add script to prepare release and improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
romankaravia committed Sep 22, 2020
1 parent 2f1e1a4 commit d744e98
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 6 deletions.
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ The code in this repository is licensed under the MIT license.

Have a look at [the steps required to extract and prepare the data](STEPS.md)

### Preparing a new release

Run this script to generate release assets in `prepare-release/release-assets`:

`{version}` should be the version tag, e.g. v0.2.0

```bash
prepare-release/prepare-release.sh {version}
```

## Uses

This data is used in the [Q Locator Map Tool](https://github.com/nzzdev/Q-locator-map),
Expand All @@ -33,15 +43,14 @@ for which a [demo](https://editor.q.tools) is also available.

### Countries (overview)

<img src="screenshot_countries.png" alt="Screenshot Countries" width="800">
<img src="screenshots/countries.png" alt="Screenshot Countries" width="800">

### Subdivisions (overview)

<img src="screenshot_subdivisions.png" alt="Screenshot Subdivisions" width="800">
<img src="screenshots/subdivisions.png" alt="Screenshot Subdivisions" width="800">

### Close-ups

<img src="screenshot_Liechtenstein.png" alt="Screenshot Liechtenstein" width="400">

<img src="screenshot_Appenzell.png" alt="Screenshot Appenzell Innerrhoden" width="400">
<img src="screenshots/Liechtenstein.png" alt="Screenshot Liechtenstein" width="400">

<img src="screenshots/Appenzell.png" alt="Screenshot Appenzell Innerrhoden" width="400">
12 changes: 11 additions & 1 deletion STEPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Landing page: https://osmdata.openstreetmap.de/data/land-polygons.html

You may want to open the file in mapshaper and check that the polygons do not self-intersect, because clipping with self-intersecting polygons will corrupt data. For example, clipping with these polygons removes most of Japan from the output:

<img src="screenshot_mapshaper.png" alt="Screenshot" width="640">
<img src="screenshots/mapshaper.png" alt="Screenshot" width="640">

You can also use
[this snapshot of land polygons](https://nzz-q-assets-stage.s3.amazonaws.com/q-locator-map/land-polygons-complete-4326_2019-11-18.zip)
Expand All @@ -38,6 +38,16 @@ Direct links:

Landing page: https://www.naturalearthdata.com/downloads/10m-cultural-vectors/

## Dependencies

Run

```bash
npm install
```

to install the dependencies.

## Steps

Run this script to execute all steps listed below:
Expand Down
1 change: 1 addition & 0 deletions prepare-release/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/release-assets
9 changes: 9 additions & 0 deletions prepare-release/copyright-notice/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Downloaded from https://github.com/nzzdev/osm-regions

LICENSE
=======

This data is Copyright 2020 OpenStreetMap contributors. It is
available under the Open Database License (ODbL).

For more information see https://www.openstreetmap.org/copyright
54 changes: 54 additions & 0 deletions prepare-release/prepare-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
set -o errexit
set -o nounset

if [ "$#" -lt 1 ]; then
echo "Version argument is missing."
exit 1
fi
version="$1"

import_osm_root=$(dirname "$0")/../import-osm
release_assets=$(dirname "$0")/release-assets
readme=$(dirname "$0")/copyright-notice/README.txt

rm -rf "$release_assets"
mkdir -p "$release_assets"

###
# Inputs
###

# land-polygons-complete-4326 => osmdata-land-polygons-{version}.zip
zip --junk-paths \
"$release_assets"/osmdata-land-polygons-"$version".zip \
"$import_osm_root"/00-static-data/land-polygons-complete-4326/*


###
# Ouputs
###

# Q{###}.json => simplified-regions-{version}.zip
zip --quiet --recurse-paths --junk-paths \
"$release_assets"/simplified-regions-"$version".zip \
"$import_osm_root"/06-simplify-regions/output \
"$readme"

# countries-clipped.json => countries-geojson-{version}.zip
zip --junk-paths \
"$release_assets"/countries-geojson-"$version".zip \
"$import_osm_root"/07-merge-regions/output/countries-clipped.json \
"$readme"

# subdivisions-clipped.json => subdivisions-geojson-{version}.zip
zip --junk-paths \
"$release_assets"/subdivisions-geojson-"$version".zip \
"$import_osm_root"/07-merge-regions/output/subdivisions-clipped.json \
"$readme"

# regions.mbtiles => regions-mbtiles-{version}.zip
zip --junk-paths \
"$release_assets"/regions-mbtiles-"$version".zip \
"$import_osm_root"/11-join-tiles/output/regions.mbtiles \
"$readme"
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit d744e98

Please sign in to comment.