-
Notifications
You must be signed in to change notification settings - Fork 4
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 ti 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
.
SQLite database
app/src/main/assets/maps.db
describes all maps available to the app. Although you can modify the database
directly it may be easier to write a JSON file describing your map and then use
a script to insert this data into the database for you:
- Create a JSON file and fill it in accordance with
data/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
- JSONs in
data/jsons
can serve as examples - Internal map name you specify in the JSON must be
$MAP_NAME
you used in the previous steps (test-map
in the examples above)
- Run
tools/create_map_db.py
providing it with the path to the database and to your JSON.- Use
--help
to see the usage instructions -
Important note: DepNav copies the database from the assets and updates
that copy only when the version of the database in the assets increases —
this means that in order to update the database of an already installed
app you need to either clear the app's storage (in your device's settings)
or increase the database version (via the corresponding parameter of
create_map_db.py
AND in the app's code here).
- Use
If you have created a new database place it at
app/src/main/assets/maps.db
overwriting the old one.