diff --git a/.gitignore b/.gitignore index 131f886..34d6b82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ node_modules/ /target/ *.png +!docs/*.png *.jpg *.jpeg .env diff --git a/README.md b/README.md index 24a38e1..3d7e6f8 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,36 @@ overlays. Rust CLI and library, CPU rendering with tiny-skia. No browser, Node.js, GUI, GPU, or async runtime. The executable does not download code or assets at startup. +## Berlin from GeoJSON + +![Berlin Mitte in four basemap styles with the same GeoJSON overlay](docs/berlin-basemaps.png) + +mapshoot is built for **automatic, reproducible screenshots of GeoJSON data**: +give it a center and radius (or a bbox), a basemap, and a GeoJSON file, and it +writes the finished PNG. No browser, screenshot service, manual tile stitching, +or post-processing step is involved. The image above renders the same overlay +data (`examples/berlin.geojson`) over four basemaps. + +```sh +# HERE, with the bundled Berlin overlay: +export MAPSHOOT_HERE_API_KEY='your-key' # legacy: HERE_API_KEY +mapshoot --center 13.405,52.52 --radius 2600 --width 800 --height 450 \ + --basemap here --here-style explore.day \ + --geojson examples/berlin.geojson --style examples/berlin-style.json \ + --output berlin-here.png + +# The same data and framing with OpenStreetMap, no key required: +mapshoot --center 13.405,52.52 --radius 2600 --width 800 --height 450 \ + --basemap osm \ + --geojson examples/berlin.geojson --style examples/berlin-style.json \ + --output berlin-osm.png +``` + +Swap `--basemap` and the style flag to compare providers; the basemap, style, +and key tables are below. The overlay is drawn in the same projected coordinate +space as the tiles, so points, lines, and polygons line up at every zoom and +fractional scale. + ## Build ```sh diff --git a/docs/berlin-basemaps.png b/docs/berlin-basemaps.png new file mode 100644 index 0000000..e83d527 Binary files /dev/null and b/docs/berlin-basemaps.png differ diff --git a/examples/berlin-style.json b/examples/berlin-style.json new file mode 100644 index 0000000..761574e --- /dev/null +++ b/examples/berlin-style.json @@ -0,0 +1,8 @@ +{ + "color": "#ff3b30", + "fillColor": "#ff3b30", + "weight": 4, + "opacity": 1, + "fillOpacity": 0.18, + "radius": 7 +} diff --git a/examples/berlin.geojson b/examples/berlin.geojson new file mode 100644 index 0000000..0e2ef90 --- /dev/null +++ b/examples/berlin.geojson @@ -0,0 +1,82 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { "name": "Museum Island" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [13.393, 52.514], + [13.403, 52.514], + [13.403, 52.522], + [13.393, 52.522], + [13.393, 52.514] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "name": "Unter den Linden" }, + "geometry": { + "type": "LineString", + "coordinates": [ + [13.3777, 52.5163], + [13.3835, 52.517], + [13.39, 52.5176], + [13.397, 52.5184], + [13.405, 52.5194], + [13.4094, 52.5208], + [13.4132, 52.5219] + ] + } + }, + { + "type": "Feature", + "properties": { "name": "Hauptbahnhof" }, + "geometry": { "type": "Point", "coordinates": [13.3694, 52.5251] } + }, + { + "type": "Feature", + "properties": { "name": "Brandenburg Gate" }, + "geometry": { "type": "Point", "coordinates": [13.3777, 52.5163] } + }, + { + "type": "Feature", + "properties": { "name": "Potsdamer Platz" }, + "geometry": { "type": "Point", "coordinates": [13.376, 52.5095] } + }, + { + "type": "Feature", + "properties": { "name": "Checkpoint Charlie" }, + "geometry": { "type": "Point", "coordinates": [13.3904, 52.5075] } + }, + { + "type": "Feature", + "properties": { "name": "Gendarmenmarkt" }, + "geometry": { "type": "Point", "coordinates": [13.392, 52.513] } + }, + { + "type": "Feature", + "properties": { "name": "Museum Island" }, + "geometry": { "type": "Point", "coordinates": [13.3975, 52.5186] } + }, + { + "type": "Feature", + "properties": { "name": "TV Tower" }, + "geometry": { "type": "Point", "coordinates": [13.4094, 52.5208] } + }, + { + "type": "Feature", + "properties": { "name": "Alexanderplatz" }, + "geometry": { "type": "Point", "coordinates": [13.4132, 52.5219] } + }, + { + "type": "Feature", + "properties": { "name": "East Side Gallery" }, + "geometry": { "type": "Point", "coordinates": [13.4397, 52.505] } + } + ] +}