-
Notifications
You must be signed in to change notification settings - Fork 5
Creating a map
This page describes how to create a new map for DepNav and add it into the app.
You are expected to have these on your hands:
- A set of images with floor schemes comprising the map. For convenience the images should be in WebP format and have the same dimensions divisible on square tiles of some size (e.g. 256x256, this is configurable).
- An image to be used as a logo, preferably in a vector format.
In DepNav maps consist of "floors" split on tiles with several zoom levels —
so-called tile pyramids. The pyramids are stored in
app/src/main/assets/tiles
as $MAP_NAME/floor$FLOOR_NUM/$ZOOM_LEVEL/$ROW/$COLUMN.webp where $MAP_NAME
can be arbitrary, $FLOOR_NUM starts from 1, $ZOOM_LEVEL, $ROW and
$COLUMN start from 0.
The easiest way to obtain such pyramids is to use
tools/create_tiles.sh —
the usage instructions are written inside the file, on Windows you will need WSL
to run it. The script will generate a pyramid for each floor, you need to place
them in the assets directory as specified above (e.g.
app/src/main/assets/tiles/test-map/floor1/$ZOOM_LEVEL/$ROW/$COLUMN.webp).
Use Android Studio's
Resource Manager
to import your map's logo. The resource must be named logo_$MAP_NAME with
hyphens replaced with underscores (e.g. logo_test_map) and be of type
drawable.
DepNav uses an SQLite database to store map descriptions. It is auto-generated during build from the latest database schema (also auto-generated, from code) and map descriptions in JSON format.
To add a map to the database:
- Create a JSON file in
app/maps/infosand fill it in accordance withapp/maps/map-info-schema.json.- The schema provides descriptions for each field you need to fill, you can configure Android Studio to help you follow the schema
- Existing JSONs can serve as examples
- Internal map name you specify in the JSON must be
$MAP_NAMEyou used in the previous steps (test-mapin the examples above)
- Increment
database version.
- Without this the database will not update automatically on devices which already have DepNav installed.
- Re-build DepNav.
- Besides the database, a new database schema will be generated in
app/schemas— it should be included in version control
- Besides the database, a new database schema will be generated in