Update README.md

This commit is contained in:
Majid Rezaei 2024-06-10 22:52:34 -04:00
parent 1cbb9d5f48
commit fcceeaa5f8

118
README.md
View File

@ -1,76 +1,42 @@
# District Heating Network Creator
## Introduction
The `DistrictHeatingNetworkCreator` class is designed to process geospatial data for district heating networks. It takes building and road data as input, identifies the nearest road to each building centroid, processes intersections, and creates a network graph representing the district heating system.
## Installation
Before using `DistrictHeatingNetworkCreator`, ensure that the required libraries are installed. You can install them using pip:
```bash
pip install geopandas networkx matplotlib shapely
```
## Usage
To use the `DistrictHeatingNetworkCreator`, follow these steps:
1. Initialize the class with paths to your GeoJSON file containing building data and Shapefile containing road data.
Example files:
- `buildings.geojson`: A GeoJSON file containing building data.
- `montreal_roads.shp`: A Shapefile containing road data for Montreal.
2. Call the `run` method to process the data and create the network graph.
3. Optionally, call the `plot_network_graph` method to visualize the network.
Example:
```python
from DistrictHeatingNetworkCreator import DistrictHeatingNetworkCreator
# Initialize the class
network_creator = DistrictHeatingNetworkCreator('path/to/buildings.geojson', 'path/to/montreal_roads.shp')
# Create the network graph
network_graph = network_creator.run()
# Plot the network graph (optional)
network_creator.plot_network_graph(network_graph)
```
## Class Methods
### `__init__(self, buildings_file, roads_file)`
Initializes the class with paths to the building and road data files.
- `buildings_file`: Path to the GeoJSON file containing building data.
- `roads_file`: Path to the Shapefile containing road data.
### `run(self)`
Executes the district heating network creation process. Returns a NetworkX graph representing the network.
### `_load_and_process_data(self)`
Loads and processes the building and road data from the specified files.
### `_find_nearest_roads(self)`
Identifies the nearest road for each building centroid and calculates the nearest point on these roads.
### `_process_intersections(self)`
Processes intersections and creates final geometries for the network graph.
### `_create_network_graph(self)`
Creates a NetworkX graph from the processed geospatial data, representing the district heating network.
### `plot_network_graph(self, network_graph)`
Plots the network graph using matplotlib and networkx.
- `network_graph`: The NetworkX graph to be plotted.
# District Heating Network Creator
## Overview
The `DistrictHeatingNetworkCreator` class is designed to create a district heating network based on building and road data. It processes GeoJSON files containing building and road data, finds the nearest roads to each building, and generates a network using NetworkX. The final network is represented as a Minimum Spanning Tree (MST) that connects building centroids to the nearest points on the road network.
## Installation
Ensure you have the necessary dependencies installed:
```bash
pip install shapely matplotlib networkx rtree
```
## Usage
To use the `DistrictHeatingNetworkCreator`, follow these steps:
1. Initialize the class with paths to your GeoJSON files containing building data road data.
2. Call the `run` method to process the data and create the network graph.
3. Optionally, call the `plot_network_graph` method to visualize the network.
Example:
```python
from DistrictHeatingNetworkCreator import DistrictHeatingNetworkCreator
# Initialize the class
network_creator = DistrictHeatingNetworkCreator('path/to/buildings.geojson', 'path/to/montreal_roads.shp')
# Create the network graph
network_graph = network_creator.run()
# Plot the network graph (optional)
network_creator.plot_network_graph(network_graph)
```
## Notes
1. Ensure your GeoJSON files are correctly formatted and contain the necessary building and road data.
2. The resulting NetworkX graph supports manual addition or removal of nodes and edges, allowing for further customization and adjustments.