Skip to content

Vonvikken/svg-maps

Repository files navigation

SVG Maps Italy

Ruby: 2.7 Ruby Style Guide pre-commit GitHub top language GitHub code size in bytes GitHub

Ruby gem used to create SVG maps of Italian comuni (i.e. municipalities) and provinces from OSM data.

Description

I made this script to create SVG maps of Italian administrative subdivisions, namely regions, provinces and comuni (singular: comune), intending to publish them on Wikipedia, like I did several years ago.

This time I chose a more complete and visually pleasant appearance (with the option to further customize them via CSS stylesheet, as explained in the wiki), showing the nearby provinces, regions and nations. Moreover, when hovering above a subdivision on the map, its name will be shown in a tooltip and its boundaries will be highlighted (though this feature can be turned off modifying the CSS).

This is how a map of a comune will look like with the default style (in this case Rimini, province of Rimini, region Emilia-Romagna):

Comune of Rimini, province of Rimini, Emilia-Romagna, Italy

The comune of interest is shown in red, whereas the other comuni of the province are in yellow. A lighter shade of yellow is for the other provinces of the same region, whereas the neighboring regions are in orange. Finally, the independent nation of San Marino is colored in gray.

Note: if you don't see the tooltips and the highlighted boundaries, try to right click on the image and select Show image.

You can perform some further visual improvements on the generated maps. See the related wiki page for details.

Prerequisites

This script uses Mapshaper and osmtogeojson to perform all the magics on the map data. If they are not installed nothing will work. And, of course, you need Ruby too! I used version 2.7, but it should work at least with 2.3.

Before the first use you need to download the source datasets. Please follow the instructions in the corresponding wiki page.

Installation

To manually build the gem, run the following script:

$ ./build_gem.sh

To install it in your system, execute:

$ gem install svg_maps_italy-<version>.gem

Usage

This script runs from command line, with the executable create_maps. The generated maps are put in the subdirectory out of the data directory.

The simplest usage is the following, using the only mandatory option -p, followed by the province code:

create_map -p PA

It creates a map of the given province (in this case Palermo) without highlighting any comune.

For more complex usage, please refer to the related wiki page.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/vonvikken/svg-maps. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

Code of Conduct

Everyone interacting in the SvgMapsItaly project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

License

This project is distributed under Apache 2.0 license.

All the map data are from OpenStreetMaps (copyright notice).