Skip to content

ubcuas/gcom-2025

Repository files navigation

GCOM

Getting Started

If you are on Windows, you will need to run this whole project in WSL

  1. Install Poetry and Redis
  2. poetry install to install all Python dependencies

Running the Server

If you are on Windows, you will need to run this whole project in WSL

  1. Start Redis Server (if not already running): redis-server
  2. Start GCOM: poetry run python server.py (in /src)
  3. Start Celery Worker: poetry run python -m celery -A gcom worker (in /src)

Major Dependencies

Overview

  • Uvicorn: ASGI Server
  • Django + DRF: For ORM and API
  • SocketIO: For WebSocket support
  • Celery: for multithreading
  • Redis: Message Broker (you will need to install this seperately)

Poetry

This project uses poetry. To install poetry, follow the guide on the website. Then run: poetry install to install required dependencies. Some relavent commands you may want to know:

  • poetry shell - Spawns and activates the poetry venv. Run exit to exit the venv
  • poetry add <module> - Add a dependency
  • poetry remove <module> - Remove a dependency
  • poetry run <command> - Run a command in the poetry venv without activating it

Swagger

Documentation is automatically generated by drf-spectacular to the OpenAPIv3 standard. Sometimes, you may wish your endpoints be displayed a bit differently and you can use the @extend_schema decorator to further control how your endpoint is displayed.

Modules

Map Tiles

Usage

This is responsible for serving OpenStreetMap(OSM) tiles for the frontend. This mainly involves 3 components:

  • Style file (osmbright.json)
    • Initially accessed by the frontend - points it to the metadata json file, and glyphs(fonts) endpoint
    • Contains layered information about how the map should be styled
  • Metadata file
    • Provides the url pattern for tile files
    • Contains some layered information about when certain map features should be displayed (probably don't mess with this too much)
  • Glyphs
    • These are just fonts stored as vector pbf files
  • Tiles
    • These are the actual map tiles that are displayed in the frontend
    • The view for these fetches a single tile at a time based on zoom level, x coord, and y coord

Creating Tiles Initially

Tiles only need to be created once, and from there can be saved and downloaded

The process for creating them is as follows:

  1. Download the province osm data from geofabric
  2. Crop the data down to the specific region that the comp is in using osmconvert - to find the coordinates of the region, use latlong
  3. Convert the single .osm.pbf into individual tile files with tilemaker - use the docker image and make sure to specify the output location as a dir not a .pbf
  4. Paste the contents of the outputted tile dir into the src/map_tiles/tile_data dir

Zipped Tiles

When you pull down the repo, there is a resources/map_tiles_archive.zip file in the maptiles app. This contains the zipped pbf tile data that is housed in the tile_data folder. When the django app starts, the file is unzipped by the apply script in map_tiles/apps.py If you update the tile data and create a new zip file _you must delete your old tile_data folder for changes to apply!

About

GCOM-2025 Repo

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published