-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
20 changed files
with
854 additions
and
2,313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./lib/gtfs-to-geojson'); | ||
export { default } from './lib/gtfs-to-geojson.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
const gtfs = require('gtfs'); | ||
const convex = require('@turf/convex').default; | ||
const { featureEach } = require('@turf/meta'); | ||
import { getStopsAsGeoJSON } from 'gtfs'; | ||
import turfConvex from '@turf/convex'; | ||
import { featureEach } from '@turf/meta'; | ||
|
||
const { simplifyGeoJSON } = require('../geojson-utils'); | ||
import { simplifyGeoJSON } from '../geojson-utils.js'; | ||
|
||
module.exports = async (config, routeId, directionId) => { | ||
const convex = async (config, routeId, directionId) => { | ||
const query = {}; | ||
|
||
if (routeId !== undefined && directionId !== undefined) { | ||
query.route_id = routeId; | ||
query.direction_id = directionId; | ||
} | ||
|
||
const stops = await gtfs.getStopsAsGeoJSON(query); | ||
const geojson = convex(stops); | ||
const stops = await getStopsAsGeoJSON(query); | ||
const geojson = turfConvex(stops); | ||
|
||
featureEach(geojson, feature => { | ||
feature.properties.agency_name = stops.features[0].properties.agency_name; | ||
}); | ||
|
||
return simplifyGeoJSON(geojson, config); | ||
}; | ||
|
||
export default convex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
const gtfs = require('gtfs'); | ||
import { getShapesAsGeoJSON, getStopsAsGeoJSON } from 'gtfs'; | ||
|
||
const { mergeGeojson, simplifyGeoJSON } = require('../geojson-utils'); | ||
import { mergeGeojson, simplifyGeoJSON } from '../geojson-utils.js'; | ||
|
||
module.exports = async (config, routeId, directionId) => { | ||
const linesAndStops = async (config, routeId, directionId) => { | ||
const query = {}; | ||
|
||
if (routeId !== undefined && directionId !== undefined) { | ||
query.route_id = routeId; | ||
query.direction_id = directionId; | ||
} | ||
|
||
const shapesGeojson = await gtfs.getShapesAsGeoJSON(query); | ||
const stopsGeojson = await gtfs.getStopsAsGeoJSON(query); | ||
const shapesGeojson = await getShapesAsGeoJSON(query); | ||
const stopsGeojson = await getStopsAsGeoJSON(query); | ||
const geojson = mergeGeojson(shapesGeojson, stopsGeojson); | ||
|
||
return simplifyGeoJSON(geojson, config); | ||
}; | ||
|
||
export default linesAndStops; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
const gtfs = require('gtfs'); | ||
const buffer = require('@turf/buffer'); | ||
import { getShapesAsGeoJSON } from 'gtfs'; | ||
import buffer from '@turf/buffer'; | ||
|
||
const { simplifyGeoJSON } = require('../geojson-utils'); | ||
import { simplifyGeoJSON } from '../geojson-utils.js'; | ||
|
||
module.exports = async (config, routeId, directionId) => { | ||
const linesBuffer = async (config, routeId, directionId) => { | ||
const query = {}; | ||
|
||
if (routeId !== undefined && directionId !== undefined) { | ||
query.route_id = routeId; | ||
query.direction_id = directionId; | ||
} | ||
|
||
const lines = await gtfs.getShapesAsGeoJSON(query); | ||
const lines = await getShapesAsGeoJSON(query); | ||
const geojson = buffer(lines, config.bufferSizeMeters, { units: 'meters' }); | ||
|
||
return simplifyGeoJSON(geojson, config); | ||
}; | ||
|
||
export default linesBuffer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
const gtfs = require('gtfs'); | ||
import { getShapesAsGeoJSON } from 'gtfs'; | ||
|
||
const { simplifyGeoJSON } = require('../geojson-utils'); | ||
import { simplifyGeoJSON } from '../geojson-utils.js'; | ||
|
||
module.exports = async (config, routeId, directionId) => { | ||
const lines = async (config, routeId, directionId) => { | ||
const query = {}; | ||
|
||
if (routeId !== undefined && directionId !== undefined) { | ||
query.route_id = routeId; | ||
query.direction_id = directionId; | ||
} | ||
|
||
const geojson = await gtfs.getShapesAsGeoJSON(query); | ||
const geojson = await getShapesAsGeoJSON(query); | ||
|
||
return simplifyGeoJSON(geojson, config); | ||
}; | ||
|
||
export default lines; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
const gtfs = require('gtfs'); | ||
const buffer = require('@turf/buffer'); | ||
import { getStopsAsGeoJSON } from 'gtfs'; | ||
import buffer from '@turf/buffer'; | ||
|
||
const { simplifyGeoJSON } = require('../geojson-utils'); | ||
import { simplifyGeoJSON } from '../geojson-utils.js'; | ||
|
||
module.exports = async (config, routeId, directionId) => { | ||
const stopsBuffer = async (config, routeId, directionId) => { | ||
const query = {}; | ||
|
||
if (routeId !== undefined && directionId !== undefined) { | ||
query.route_id = routeId; | ||
query.direction_id = directionId; | ||
} | ||
|
||
const stops = await gtfs.getStopsAsGeoJSON(query); | ||
const stops = await getStopsAsGeoJSON(query); | ||
|
||
const geojson = buffer(stops, config.bufferSizeMeters, { units: 'meters' }); | ||
|
||
return simplifyGeoJSON(geojson, config); | ||
}; | ||
|
||
export default stopsBuffer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.