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

Support for new data types when reading/writing networks #73

Merged
merged 36 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ff00c11
add placeholders for methods
KasiaKoz Mar 25, 2021
f2aa912
add json write methods
KasiaKoz Mar 25, 2021
50f59ef
change+move gtfs read method
KasiaKoz Mar 26, 2021
f1f71ce
add test
KasiaKoz Mar 26, 2021
832585d
add transform to gts method
KasiaKoz Mar 29, 2021
53e8b59
add csv/txt write methods for schedule gtfs
KasiaKoz Mar 29, 2021
8f46dd0
fix in gtfs read to not include routes with single stop
KasiaKoz Mar 29, 2021
8556a89
update read gtfs notebook
KasiaKoz Mar 29, 2021
a0d19ed
add notebook for writing gtfs outputs, small fixes to methods
KasiaKoz Mar 29, 2021
e36e159
add to_geodataframe network method
KasiaKoz Mar 29, 2021
906c807
add logging, split encoding geometry dataframe
KasiaKoz Mar 30, 2021
da17687
add CSV read notebook and update gtfs write nb
KasiaKoz Mar 30, 2021
2157a1a
correct json outputs w.r.t. geometries
KasiaKoz Mar 30, 2021
ca244ae
tidy up csv save for schedule
KasiaKoz Mar 30, 2021
8687f17
add read csv method
KasiaKoz Mar 30, 2021
8618ab7
add reading CSV notebook and logging
KasiaKoz Mar 30, 2021
b95a6fe
add method to read json
KasiaKoz Mar 30, 2021
c135ac6
tidy up geojson outs/geodataframe transform
KasiaKoz Mar 30, 2021
7213bc4
update doc strings
KasiaKoz Mar 30, 2021
aee2a32
geojson read method
KasiaKoz Mar 31, 2021
0a3a894
reading json and geojson notebook and example data
KasiaKoz Mar 31, 2021
2262da1
move read matsim method
KasiaKoz Mar 31, 2021
b3c93a0
update jupyter notebooks
KasiaKoz Mar 31, 2021
e1ef857
Merge branch 'master' into new-network-in-out-puts
KasiaKoz Mar 31, 2021
7a9ebe4
Merge branch 'master' into new-network-in-out-puts
KasiaKoz Mar 31, 2021
a44a533
fix tests
KasiaKoz Mar 31, 2021
6faa07f
add encoding
KasiaKoz Mar 31, 2021
d5a6a2c
specify dtypes
KasiaKoz Mar 31, 2021
4d75acc
specify dtypes, fix test
KasiaKoz Mar 31, 2021
d64646a
move osm read method to read module
KasiaKoz Apr 14, 2021
879dfaf
Merge branch 'master' into new-network-in-out-puts
KasiaKoz Apr 16, 2021
05f5219
refactor
KasiaKoz Apr 26, 2021
c0d44ac
incorporate loopy gtfs fix
KasiaKoz Apr 26, 2021
d97d8b5
incorporate loopy gtfs fix
KasiaKoz Apr 26, 2021
c0c8d91
PR comments
KasiaKoz Apr 27, 2021
cdac28f
Merge branch 'master' into new-network-in-out-puts
KasiaKoz Apr 27, 2021
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
3 changes: 3 additions & 0 deletions example_data/example_csv/links.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
index,from,modes,oneway,s2_to,attributes,capacity,freespeed,to,length,geometry,permlanes,id,s2_from
1,25508485,{'car'},1,5221390302696205321,"{'osm:way:access': {'name': 'osm:way:access', 'class': 'java.lang.String', 'text': 'permissive'}, 'osm:way:highway': {'name': 'osm:way:highway', 'class': 'java.lang.String', 'text': 'unclassified'}, 'osm:way:id': {'name': 'osm:way:id', 'class': 'java.lang.Long', 'text': '26997928'}, 'osm:way:name': {'name': 'osm:way:name', 'class': 'java.lang.String', 'text': 'Brunswick Place'}}",600.0,4.166666666666667,21667818,52.765151087870265,kevj`maB_`la`}`@{ooxA`k~rH,1.0,1,5221390301001263407
10,200048,{'car'},1,5221390299830573099,"{'osm:way:access': {'name': 'osm:way:access', 'class': 'java.lang.String', 'text': 'permissive'}, 'osm:way:highway': {'name': 'osm:way:highway', 'class': 'java.lang.String', 'text': 'unclassified'}, 'osm:way:id': {'name': 'osm:way:id', 'class': 'java.lang.Long', 'text': '26997927'}, 'osm:way:name': {'name': 'osm:way:name', 'class': 'java.lang.String', 'text': 'Macfarren Place'}}",600.0,4.166666666666667,295927764,53.77508435879174,{nuphlaBkmquj|`@v`ab@uxieI,1.0,10,5221390299873156021
5 changes: 5 additions & 0 deletions example_data/example_csv/nodes.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
index,x,y,lat,lon,s2_id,geometry,id
25508485,528489.467895946,182206.20303669578,51.524162533239284,-0.14930198709481451,5221390301001263407,"(528489.467895946, 182206.20303669578)",25508485
21667818,528504.1342843144,182155.7435136598,51.52370573323939,-0.14910908709500162,5221390302696205321,"(528504.1342843144, 182155.7435136598)",21667818
295927764,528358.873300625,182147.6313714285,51.52366583323934,-0.15120468709594614,5221390299830573099,"(528358.873300625, 182147.6313714285)",295927764
200048,528364.6182191424,182094.16422237462,51.52318403323943,-0.1511413870962065,5221390299873156021,"(528364.6182191424, 182094.16422237462)",200048
8 changes: 8 additions & 0 deletions example_data/example_geojson/network_links.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::27700" } },
"features": [
{ "type": "Feature", "properties": { "index": "1", "id": "1", "from": "25508485", "to": "21667818", "freespeed": 4.166666666666667, "capacity": 600.0, "permlanes": 1.0, "oneway": "1", "modes": "car", "s2_from": 5221390301001263407, "s2_to": 5221390302696205321, "attributes": { "osm:way:access": { "name": "osm:way:access", "class": "java.lang.String", "text": "permissive" }, "osm:way:highway": { "name": "osm:way:highway", "class": "java.lang.String", "text": "unclassified" }, "osm:way:id": { "name": "osm:way:id", "class": "java.lang.Long", "text": "26997928" }, "osm:way:name": { "name": "osm:way:name", "class": "java.lang.String", "text": "Brunswick Place" } }, "length": 52.765151087870265 }, "geometry": { "type": "LineString", "coordinates": [ [ 528489.467895945999771, 182206.203036695776973 ], [ 528504.134284314350225, 182155.743513659806922 ] ] } },
{ "type": "Feature", "properties": { "index": "10", "id": "10", "from": "200048", "to": "295927764", "freespeed": 4.166666666666667, "capacity": 600.0, "permlanes": 1.0, "oneway": "1", "modes": "car", "s2_from": 5221390299873156021, "s2_to": 5221390299830573099, "attributes": { "osm:way:access": { "name": "osm:way:access", "class": "java.lang.String", "text": "permissive" }, "osm:way:highway": { "name": "osm:way:highway", "class": "java.lang.String", "text": "unclassified" }, "osm:way:id": { "name": "osm:way:id", "class": "java.lang.Long", "text": "26997927" }, "osm:way:name": { "name": "osm:way:name", "class": "java.lang.String", "text": "Macfarren Place" } }, "length": 53.775084358791737 }, "geometry": { "type": "LineString", "coordinates": [ [ 528364.618219142430462, 182094.164222374616656 ], [ 528358.873300625011325, 182147.631371428491548 ] ] } }
]
}
10 changes: 10 additions & 0 deletions example_data/example_geojson/network_nodes.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::27700" } },
"features": [
{ "type": "Feature", "properties": { "index": "25508485", "id": "25508485", "x": 528489.467895946, "y": 182206.20303669578, "lon": -0.14930198709481451, "lat": 51.524162533239284, "s2_id": 5221390301001263407 }, "geometry": { "type": "Point", "coordinates": [ 528489.467895945999771, 182206.203036695776973 ] } },
{ "type": "Feature", "properties": { "index": "21667818", "id": "21667818", "x": 528504.13428431435, "y": 182155.74351365981, "lon": -0.14910908709500162, "lat": 51.523705733239389, "s2_id": 5221390302696205321 }, "geometry": { "type": "Point", "coordinates": [ 528504.134284314350225, 182155.743513659806922 ] } },
{ "type": "Feature", "properties": { "index": "200048", "id": "200048", "x": 528364.61821914243, "y": 182094.16422237462, "lon": -0.1511413870962065, "lat": 51.523184033239431, "s2_id": 5221390299873156021 }, "geometry": { "type": "Point", "coordinates": [ 528364.618219142430462, 182094.164222374616656 ] } },
{ "type": "Feature", "properties": { "index": "295927764", "id": "295927764", "x": 528358.87330062501, "y": 182147.63137142849, "lon": -0.15120468709594614, "lat": 51.523665833239342, "s2_id": 5221390299830573099 }, "geometry": { "type": "Point", "coordinates": [ 528358.873300625011325, 182147.631371428491548 ] } }
]
}
126 changes: 126 additions & 0 deletions example_data/example_json/network.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"nodes": {
"25508485": {
"id": "25508485",
"lon": -0.14930198709481451,
"y": 182206.20303669578,
"x": 528489.467895946,
"geometry": [
528489.467895946,
182206.20303669578
],
"lat": 51.524162533239284,
"s2_id": 5221390301001263407
},
"21667818": {
"id": "21667818",
"lon": -0.14910908709500162,
"y": 182155.7435136598,
"x": 528504.1342843144,
"geometry": [
528504.1342843144,
182155.7435136598
],
"lat": 51.52370573323939,
"s2_id": 5221390302696205321
},
"295927764": {
"id": "295927764",
"lon": -0.15120468709594614,
"y": 182147.6313714285,
"x": 528358.873300625,
"geometry": [
528358.873300625,
182147.6313714285
],
"lat": 51.52366583323934,
"s2_id": 5221390299830573099
},
"200048": {
"id": "200048",
"lon": -0.1511413870962065,
"y": 182094.16422237462,
"x": 528364.6182191424,
"geometry": [
528364.6182191424,
182094.16422237462
],
"lat": 51.52318403323943,
"s2_id": 5221390299873156021
}
},
"links": {
"1": {
"id": "1",
"attributes": {
"osm:way:access": {
"name": "osm:way:access",
"class": "java.lang.String",
"text": "permissive"
},
"osm:way:highway": {
"name": "osm:way:highway",
"class": "java.lang.String",
"text": "unclassified"
},
"osm:way:id": {
"name": "osm:way:id",
"class": "java.lang.Long",
"text": "26997928"
},
"osm:way:name": {
"name": "osm:way:name",
"class": "java.lang.String",
"text": "Brunswick Place"
}
},
"s2_from": 5221390301001263407,
"freespeed": 4.166666666666667,
"to": "21667818",
"permlanes": 1.0,
"modes": "car",
"geometry": "kevj`maB_`la`}`@{ooxA`k~rH",
"oneway": "1",
"from": "25508485",
"s2_to": 5221390302696205321,
"length": 52.765151087870265,
"capacity": 600.0
},
"10": {
"id": "10",
"attributes": {
"osm:way:access": {
"name": "osm:way:access",
"class": "java.lang.String",
"text": "permissive"
},
"osm:way:highway": {
"name": "osm:way:highway",
"class": "java.lang.String",
"text": "unclassified"
},
"osm:way:id": {
"name": "osm:way:id",
"class": "java.lang.Long",
"text": "26997927"
},
"osm:way:name": {
"name": "osm:way:name",
"class": "java.lang.String",
"text": "Macfarren Place"
}
},
"s2_from": 5221390299873156021,
"freespeed": 4.166666666666667,
"to": "295927764",
"permlanes": 1.0,
"modes": "car",
"geometry": "{nuphlaBkmquj|`@v`ab@uxieI",
"oneway": "1",
"from": "200048",
"s2_to": 5221390299830573099,
"length": 53.77508435879174,
"capacity": 600.0
}
}
}
120 changes: 120 additions & 0 deletions example_data/example_json/schedule.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"schedule": {
"stops": {
"490000235X.link:1": {
"lon": 51.51668503324075,
"id": "490000235X.link:1",
"name": "Tottenham Court Road Station (Stop X)",
"y": 181412.0975758662,
"lat": -0.12809598708996447,
"x": 529981.7958802709,
"isBlocking": "false",
"linkRefId": "1",
"s2_id": 2507584377443783851
},
"490000235YB.link:10": {
"lon": 51.51609803324078,
"id": "490000235YB.link:10",
"name": "Oxford Street Soho Street (Stop YB)",
"y": 181336.2815925331,
"lat": -0.13404398709291862,
"x": 529570.7813227688,
"isBlocking": "false",
"linkRefId": "10",
"s2_id": 2507584474601580133
}
},
"services": {
"20274": {
"id": "20274",
"name": "N55",
"routes": {
"VJ6c64ab7b477e201cae950efde5bd0cb4e2e8888e": {
"route_short_name": "N55",
"mode": "bus",
"trips": {
"trip_id": [
"VJ4e00b97ca9c6c0c96da8f793dfbd37b11f647fa7_03:40:00"
],
"trip_departure_time": [
"03:40:00"
],
"vehicle_id": [
"veh_0_bus"
]
},
"arrival_offsets": [
"00:00:00",
"00:02:20"
],
"departure_offsets": [
"00:00:00",
"00:02:20"
],
"route_long_name": "",
"id": "VJ6c64ab7b477e201cae950efde5bd0cb4e2e8888e",
"route": [
"1",
"10"
],
"await_departure": [
true,
true
],
"ordered_stops": [
"490000235X.link:1",
"490000235YB.link:10"
]
}
}
}
},
"minimal_transfer_times": {
"490000235X.link:1": {
"stop": "490000235YB.link:10",
"transferTime": 100.0
},
"490000235YB.link:10": {
"stop": "490000235X.link:1",
"transferTime": 100.0
}
}
},
"vehicles": {
"vehicle_types": {
"bus": {
"capacity": {
"seats": {
"persons": "70"
},
"standingRoom": {
"persons": "0"
}
},
"length": {
"meter": "18.0"
},
"width": {
"meter": "2.5"
},
"accessTime": {
"secondsPerPerson": "0.5"
},
"egressTime": {
"secondsPerPerson": "0.5"
},
"doorOperation": {
"mode": "serial"
},
"passengerCarEquivalents": {
"pce": "2.8"
}
}
},
"vehicles": {
"veh_0_bus": {
"type": "bus"
}
}
}
}
3 changes: 2 additions & 1 deletion genet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from genet.core import Network # noqa: F401
from genet.schedule_elements import Schedule, Service, Route, Stop # noqa: F401
from genet.inputs_handler.read import * # noqa: F401,F403
from genet.auxiliary_files import AuxiliaryFile # noqa: F401
from genet.exceptions import ScheduleElementGraphSchemaError, RouteInitialisationError, \
ServiceInitialisationError # noqa: F401
from genet.utils import graph_operations # noqa: F401
from genet.utils import google_directions # noqa: F401,F403
from genet.utils import google_directions # noqa: F401
Loading