A Kotlin library to fetch and rename OSM tiles for further usage.
APACHE-2.0 License
OSM Tile Manager is a Kotlin application that allows you to download map tiles from a specified area and range of zoom levels as .png
pictures.
The downloaded tiles follow the /zoom/x/y
convention, making them compatible with various mapping libraries and applications (e.g. MapCompose).
Please consider the OpenStreetMap tile usage policy and the OSM Wiki Downloading data before using this application. Download the tiles responsibly and avoid overloading the OSM servers.
Clone the repository:
git clone [email protected]:feczkob/osm-tile-manager.git
Navigate to the project directory:
cd osm-tile-manager
Create a .env
file in the root of the project and set the following parameters.
Replace the values with the appropriate path, coordinates of the desired area and zoom level(s).
See .env.example
for an example.
TILES_PATH=/your/path/to/the/tiles/folder
TOP_LEFT_LAT=47.5189
TOP_LEFT_LON=19.0129
BOTTOM_RIGHT_LAT=47.4724
BOTTOM_RIGHT_LON=19.0829
MIN_ZOOM=13
MAX_ZOOM=14
Build the project:
./gradlew clean build
To download the tiles,
execute the following command:
./gradlew fetchTiles
or
run the main()
method in the GenerateTiles.kt
file.
Verify that the tiles have been downloaded in the specified directory.
The fetched tiles cover the specified area (given in the .env
file), and the same area is downloaded on all zoom levels.
The coordinates of the specified area and the one being fetched are usually different.
Read the README.md
file next to the tiles for more information.
To rename the downloaded tiles,
execute the following command:
./gradlew renameTiles
or
run the main()
method in the RenameTiles.kt
file.
Verify that the previously downloaded tiles have been renamed according to the specified convention.