Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add osm2cityflow #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tests/azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ stages:
steps:
- script: sudo -E apt-add-repository -y ppa:deadsnakes/ppa
displayName: Update source
- script: sudo apt update && sudo apt install -y python3.7-dev
- script: sudo apt update && sudo apt install -y python3.7-dev && python3.7 -m pip install pyproj folium
displayName: Install dependency
- script: git clone https://github.com/cityflow-project/data.git
displayName: Download data
- template: template/install_gtest.yml
- template: template/build.yml
parameters:
Expand All @@ -95,6 +97,10 @@ stages:
pool:
vmImage: 'macOS-latest'
steps:
- script: python3 -m pip install pyproj folium
displayName: Install dependency
- script: git clone https://github.com/cityflow-project/data.git
displayName: Download data
- template: template/install_gtest.yml
- template: template/build.yml
parameters:
Expand Down
23 changes: 23 additions & 0 deletions tests/python/test_osm_converter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import unittest
import os
import json
from tools.converter.osm2cityflow import extract, draw


class TestOsmConverter(unittest.TestCase):
dataPath = os.getcwd() + '/data/tools/Converter/examples/'
osmFile = dataPath + 'statecollege.osm'
CityFlowFile = dataPath + 'statecollege_roadnet.json'

def test_converter(self):
nodes = extract(osmFile=self.osmFile)
draw(nodes, self.CityFlowFile, True)
with open(self.CityFlowFile, 'r') as f:
roadnet = json.load(f)
intersectionsNum = len(roadnet["intersections"])
roadsNum = len(roadnet["roads"])
self.assertTrue(intersectionsNum <= roadsNum)


if __name__ == '__main__':
unittest.main(verbosity=2)
Loading