{ "cells": [ { "cell_type": "markdown", "id": "56055bd3", "metadata": {}, "source": [ "### Exporting the processed intersections, bus stops and focus points to the VED files." ] }, { "cell_type": "code", "execution_count": 1, "id": "b1e30678", "metadata": {}, "outputs": [], "source": [ "import os\n", "import pandas as pd\n", "import numpy as np\n", "from tqdm.notebook import tqdm\n", "import folium\n", "import csv" ] }, { "cell_type": "markdown", "id": "0591f464", "metadata": {}, "source": [ "Read three CSV files: intersections, focus points and bus stops." ] }, { "cell_type": "code", "execution_count": 2, "id": "b380a50a", "metadata": {}, "outputs": [], "source": [ "intersections = pd.read_csv('../data/processed/joined_coords_intersections.csv').to_numpy()\n", "focus_points = pd.read_csv('../data/processed/joined_layer_coords_focus_points.csv')\n", "# combine different focus points in the 'highway' column\n", "focus_points['highway'] = focus_points.bfill(1)['highway']\n", "focus_points = focus_points.to_numpy()\n", "busstops = pd.read_csv('../data/processed/joined_coords_bus_stops.csv').to_numpy()" ] }, { "cell_type": "markdown", "id": "bf202e40", "metadata": {}, "source": [ "Create dictionaries where keys are the latitude/longitude coordinates." ] }, { "cell_type": "code", "execution_count": 3, "id": "2a3c3ebb", "metadata": {}, "outputs": [], "source": [ "intersections_dict = {(intersections[i,0], intersections[i,1]) : 1 for i in range(len(intersections))}\n", "busstops_dict = {(busstops[i,0], busstops[i,1]) : 1 for i in range(len(busstops))}\n", "focus_points_dict = {(focus_points[i,0], focus_points[i,1]) : focus_points[i,4] for i in range(len(focus_points))}" ] }, { "cell_type": "markdown", "id": "170161c7", "metadata": {}, "source": [ "Let's visualize some of the intersections. Folium map is slow if we try to plot all of them. Therefore, we will plot the first 1000 intersections." ] }, { "cell_type": "code", "execution_count": 4, "id": "66bb6abd", "metadata": {}, "outputs": [ { "data": { "text/html": [ "