{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Plot Activity Plan Travel\n", "\n", "In this example, we show how plans can be plotted spatially using `plotly`" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2023-09-22T10:52:14.828872Z", "iopub.status.busy": "2023-09-22T10:52:14.828633Z", "iopub.status.idle": "2023-09-22T10:52:15.713109Z", "shell.execute_reply": "2023-09-22T10:52:15.712778Z" } }, "outputs": [], "source": [ "import os\n", "\n", "from pam import read" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2020-10-06T10:20:37.236634Z", "start_time": "2020-10-06T10:20:37.225346Z" }, "execution": { "iopub.execute_input": "2023-09-22T10:52:15.714795Z", "iopub.status.busy": "2023-09-22T10:52:15.714674Z", "iopub.status.idle": "2023-09-22T10:52:15.722167Z", "shell.execute_reply": "2023-09-22T10:52:15.721841Z" } }, "outputs": [], "source": [ "pop = read.read_matsim(\n", " os.path.join(\"data\", \"example_data\", \"example_plans.xml\")\n", ") # load small sample from the test suite" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2020-10-06T08:20:39.697270Z", "start_time": "2020-10-06T08:20:39.689099Z" } }, "source": [ "You can generate `geopandas.GeoDataFrames` for `Population`'s, `Household`'s or `Person`'s travel. the `route_id`, `service_id` and `network_route` refer to the network used for running the simulation. `GeoDataFrame`s are very useful, they let you to generate geojsons simply and quickly, which you can then load up in kepler.\n", "\n", "```\n", "gdf.to_file('path/to/file/gdf.geojson'), driver='GeoJSON')\n", "```\n", "note that to use this geojson with kepler you will need the geometry to be in `'epsg:4326'`. You can do this with the method below." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2020-10-06T10:20:37.916744Z", "start_time": "2020-10-06T10:20:37.239908Z" }, "execution": { "iopub.execute_input": "2023-09-22T10:52:15.723742Z", "iopub.status.busy": "2023-09-22T10:52:15.723655Z", "iopub.status.idle": "2023-09-22T10:52:16.113986Z", "shell.execute_reply": "2023-09-22T10:52:16.113518Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", " | mode | \n", "purp | \n", "seq | \n", "freq | \n", "start_time | \n", "end_time | \n", "start_location | \n", "end_location | \n", "geometry | \n", "distance | \n", "service_id | \n", "route_id | \n", "o_stop | \n", "d_stop | \n", "network_route | \n", "pid | \n", "hid | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "pt | \n", "work | \n", "1 | \n", "None | \n", "1900-01-01 07:24:52 | \n", "1900-01-01 07:24:52 | \n", "(515226.0, 188222.0) | \n", "(529652.0, 183897.0) | \n", "LINESTRING (-0.33840 51.58109, -0.13191 51.53909) | \n", "15060.381834 | \n", "None | \n", "None | \n", "None | \n", "None | \n", "[] | \n", "census_0 | \n", "census_0 | \n", "
1 | \n", "pt | \n", "None | \n", "2 | \n", "None | \n", "1900-01-01 14:50:52 | \n", "1900-01-01 14:50:52 | \n", "(529652.0, 183897.0) | \n", "(515226.0, 188222.0) | \n", "LINESTRING (-0.13191 51.53909, -0.33840 51.58109) | \n", "15060.381834 | \n", "None | \n", "None | \n", "None | \n", "None | \n", "[] | \n", "census_0 | \n", "census_0 | \n", "
2 | \n", "pt | \n", "work | \n", "1 | \n", "None | \n", "1900-01-01 08:27:33 | \n", "1900-01-01 08:27:33 | \n", "(542920.0, 174494.0) | \n", "(534457.0, 181724.0) | \n", "LINESTRING (0.05547 51.45140, -0.06349 51.51844) | \n", "11130.825172 | \n", "None | \n", "None | \n", "None | \n", "None | \n", "[] | \n", "census_1 | \n", "census_1 | \n", "
3 | \n", "pt | \n", "None | \n", "2 | \n", "None | \n", "1900-01-01 17:45:33 | \n", "1900-01-01 17:45:33 | \n", "(534457.0, 181724.0) | \n", "(542920.0, 174494.0) | \n", "LINESTRING (-0.06349 51.51844, 0.05547 51.45140) | \n", "11130.825172 | \n", "None | \n", "None | \n", "None | \n", "None | \n", "[] | \n", "census_1 | \n", "census_1 | \n", "
4 | \n", "pt | \n", "work | \n", "1 | \n", "None | \n", "1900-01-01 07:01:09 | \n", "1900-01-01 07:01:09 | \n", "(535063.0, 163365.0) | \n", "(531998.0, 166080.0) | \n", "LINESTRING (-0.06176 51.35331, -0.10474 51.37843) | \n", "4094.563469 | \n", "None | \n", "None | \n", "None | \n", "None | \n", "[] | \n", "census_10 | \n", "census_10 | \n", "