Skip to content

Commit

Permalink
Dependency update, version bump
Browse files Browse the repository at this point in the history
Remove bluebird
Update mongoose connection options
Update to node-gtfs 1.0.1
  • Loading branch information
brendannee committed Aug 10, 2017
1 parent 95e8eaa commit 94448ee
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 234 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Install `gtfs-to-geojson` directly from [npm](https://npmjs.org):
const config = require('config.json');

mongoose.Promise = global.Promise;
mongoose.connect(config.mongoUrl);
mongoose.connect(config.mongoUrl, {useMongoClient: true});

gtfsToGeoJSON(config)
.then(() => {
Expand Down
5 changes: 2 additions & 3 deletions lib/gtfs-to-geojson.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const _ = require('lodash');
const fs = require('fs-extra');
const gtfs = require('gtfs');
const geojsonMerge = require('@mapbox/geojson-merge');
const Promise = require('bluebird');
const Table = require('cli-table');
const Timer = require('timer-machine');

Expand Down Expand Up @@ -81,7 +80,7 @@ module.exports = async config => {

timer.start();

await Promise.each(config.agencies, async agency => {
for (const agency of config.agencies) {
const agencyKey = agency.agency_key;
const exportPath = utils.getExportPath(agencyKey);

Expand Down Expand Up @@ -112,7 +111,7 @@ module.exports = async config => {
}

log(`GeoJSON for ${agencyKey} created at ${geojsonPath}`);
});
}

const logText = await utils.generateLogText(stats);

Expand Down
8 changes: 4 additions & 4 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ exports.simplifyGeoJSON = (geojson, coordinatePrecision) => {
return geojson;
}

geojson.features.forEach(feature => {
feature.geometry.coordinates.forEach(coordinate => {
for (const feature of geojson.features) {
for (const coordinate of feature.geometry.coordinates) {
const multiplier = Math.pow(10, coordinatePrecision);
coordinate[0] = Math.round(coordinate[0] * multiplier) / multiplier;
coordinate[1] = Math.round(coordinate[1] * multiplier) / multiplier;
});
});
}
}

return geojson;
};
Expand Down
Loading

0 comments on commit 94448ee

Please sign in to comment.