Skip to content

Latest commit

 

History

History
124 lines (86 loc) · 4.01 KB

File metadata and controls

124 lines (86 loc) · 4.01 KB

djangoSRI

A conceptual, logical, and archetype data model for the Smart Readiness Indicator (SRI). The project extends CityGML via an Application Domain Extension (ADE) and integrates with Django to provide a REST API and GIS-based web application.

The concept is illustrated in the following figure:

20240824_GraphicalAbstract.drawio.png

Project Overview

The project consists of four main components:

  1. SRI Data Model: Defines the data structure for SRI and functionality levels.
  2. Digital Archetypes: Predefined building configurations for different SRI levels.
  3. CityGML & 3DCityDB Extension: Enhances CityGML with an ADE for SRI.
  4. Django App & API: Provides an installable Django app to manage and query SRI-related data.

CityGML & Django Integration

Introduction

django-sri is an extension for CityGML and 3DCityDB, allowing for the integration of SRI-related data into a Django-based environment. It is compliant with the 3DCityDB schema and ADE specifications, and enables:

  • Storage of mapped SRI data and functionality levels
  • REST API for querying CityGML objects with SRI extensions
  • Django templates and static JavaScript for GIS-based web applications

Requirements

To run this app, you need:

  • PostgreSQL with PostGIS
  • InfluxDB (for time-series data if required)
  • Django environment

As a reference for setting up dependencies, you can use vDistrict, which includes detailed installation instructions for databases and the Django environment.


Installation of django-sri as an installable Python package

1. Clone the Repository

git clone [SSH-Key/Https]

2. Install django-sri locally

pip install -e [Path/to/your/django-sri/Clone]

3. Integrate into a Django Project

Add sridb to your INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    ...
    'sridb',
]

Include sri URLs in your urls.py:

from django.urls import include, path
urlpatterns = [
    path('sridb/', include('sridb.urls')),
]

Run database migrations (Necessary for relationship in joint table!):

python manage.py migrate sridb --fake-initial
python manage.py makemigrations sridb
python manage.py migrate

Verify installation:

python manage.py runserver

Access at: http://127.0.0.1:8000/sri/


Archetype-Based Building Creation

The django-sri module includes archetype definitions to automatically configure buildings based on their SRI levels.

Example: Creating a New Building Based on an Archetype

  1. Upload service catalog from a SRI catalogue with python manage.py populate_service_catalog <path_to_catalogue> <building_id>
  2. Upload assessment from Service sheet v4.5 with python manage.py upload_builiding <path_to_catalogue> <building_id>
  3. Create digital archetypes with python manage.py create_archetype <path_to_catalogue> <building_id>

CityGML Generation with SRI ADE

This module extends CityGML with an ADE for SRI-related information.

Generating CityGML for a Building

from citygml.generate_citygml import generate_citygml
citygml_data = generate_citygml("B123")
print(citygml_data)

Version

This is version 0.1.0.


How to Contribute?

Thanks for contributing! Please follow our contribution guide.


License

This project is licensed under MIT License.


Acknowledgements

django-sri has been developed within public-funded projects with financial support by BMWk (German Federal Ministry for Economic Affairs and Climate Action) and the Institute for Energy Efficient Buildings and Indoor Climate.