Skip to content

Commit

Permalink
add map to grid script
Browse files Browse the repository at this point in the history
  • Loading branch information
piebro committed Dec 11, 2023
1 parent 04ac8bd commit a3bea76
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Plotting a map on an A3 piece of paper.

![Image of a plotter plotting a map](images/plotting_image.png)

If you want to plot the map on mulitple piece of papers, you can use the `map_to_grid.sh` script.

A similar, cool project with a different UX and output is: https://github.com/anvaka/city-roads/ and another project to visualize maps in a custom way (also for plotters) is: https://github.com/marceloprates/prettymaps

## Contributing
Expand Down
15 changes: 15 additions & 0 deletions map_to_grid.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
INPUT=$1
OUTPUT=out
GRID_X_COUNT=3
GRID_Y_COUNT=3
GRID_X_LENGTH_MM=100
GRID_Y_LENGTH_MM=100

for i in $(seq 1 $GRID_X_COUNT); do
for j in $(seq 1 $GRID_Y_COUNT); do
start_crop_x=$(bc -l <<< "a=$i-1; a*$GRID_X_LENGTH_MM");
start_crop_y=$(bc -l <<< "a=$j-1; a*$GRID_Y_LENGTH_MM");
vpype read ${INPUT} crop ${start_crop_x}mm ${start_crop_y}mm ${GRID_X_LENGTH_MM}mm ${GRID_Y_LENGTH_MM}mm write --page-size ${GRID_X_LENGTH}x${GRID_Y_LENGTH}mm --center ${OUTPUT}_${i}_${j}.svg;
echo "${OUTPUT}_${i}_${j}.svg"
done;
done;

0 comments on commit a3bea76

Please sign in to comment.