[gnome-maps/wip/mlundblad/transit-plugin-gtfs-local: 7/7] WIP: Add transit plugin doing local routing on dowloaded GTFS
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/transit-plugin-gtfs-local: 7/7] WIP: Add transit plugin doing local routing on dowloaded GTFS
- Date: Mon, 16 Mar 2020 22:43:14 +0000 (UTC)
commit dd2045c2a92077e44cd72b760755fee264930ca8
Author: Marcus Lundblad <ml update uu se>
Date: Wed Feb 19 23:10:55 2020 +0100
WIP: Add transit plugin doing local routing on dowloaded GTFS
src/org.gnome.Maps.src.gresource.xml | 1 +
src/transitplugins/gtfs.js | 54 ++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
---
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index 8ecc6e9c..74ce1dee 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -114,6 +114,7 @@
<file alias="geojsonvt/tile.js">tile.js</file>
<file alias="geojsonvt/transform.js">transform.js</file>
<file alias="geojsonvt/wrap.js">wrap.js</file>
+ <file>transitplugins/gtfs.js</file>
<file>transitplugins/opendataCH.js</file>
<file>transitplugins/openTripPlanner.js</file>
<file>transitplugins/resrobot.js</file>
diff --git a/src/transitplugins/gtfs.js b/src/transitplugins/gtfs.js
new file mode 100644
index 00000000..d629e0ba
--- /dev/null
+++ b/src/transitplugins/gtfs.js
@@ -0,0 +1,54 @@
+/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2020 Marcus Lundblad
+ *
+ * GNOME Maps is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * GNOME Maps is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Marcus Lundblad <ml update uu se>
+ */
+
+const Maps = imports.gi.GnomeMaps;
+
+const Application = imports.application;
+const Utils = imports.utils;
+
+var GTFS = class GTFS {
+ constructor(params) {
+ // TODO: for now just read files from an unzipped GTFS file at path…
+ this._gtfs = Maps.GTFS.new(params.name);
+ this._query = Application.routeQuery;
+ Utils.debug('end constructor');
+ }
+
+ fetchFirstResults() {
+ let filledPoints = this._query.filledPoints;
+ let extract = this._gtfs.parse();
+ let startLat = filledPoints[0].place.location.latitude;
+ let startLon = filledPoints[0].place.location.longitude;
+ let endLat = filledPoints.last().place.location.latitude;
+ let endLon = filledPoints.last().place.location.longitude;
+
+ Utils.debug('stops near start');
+ let startStops = this._gtfs.get_nearby_stops(startLat, startLon, 2000);
+
+ Utils.debug('stops near end');
+ let endStops = this._gtfs.get_nearby_stops(endLat, endLon, 2000);
+
+ }
+
+ fetchMoreResults() {
+
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]