-
Notifications
You must be signed in to change notification settings - Fork 13
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
OSM points loaded into db #206
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6dbf01e
moved osm-related scripts to its own folder
bleucitron 6351e38
simplified db management
bleucitron 94cb233
added the update-table capability
bleucitron 3a99cfc
added osmTable to db
bleucitron 6b1e91c
fixed dropAllTable to include osmplaces
bleucitron b476408
load OSM points to 6element db
bleucitron b31312b
fixed various bugs avoiding points to load from osm db
bleucitron 5ed0737
fixed merge conflicts
bleucitron 455a3ce
removed unused osmplaces methods
bleucitron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -25,8 +25,11 @@ CREATE TABLE IF NOT EXISTS networks ( | |
color text NOT NULL, | ||
url text DEFAULT NULL | ||
) INHERITS(lifecycle); | ||
|
||
DROP TRIGGER IF EXISTS updated_at_networks on networks; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you have a look on issue #191 ? Does this solve the issue ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't... |
||
CREATE TRIGGER updated_at_networks BEFORE UPDATE ON networks FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column(); | ||
|
||
|
||
CREATE TABLE IF NOT EXISTS places ( | ||
id SERIAL PRIMARY KEY, | ||
name text NOT NULL, | ||
|
@@ -50,6 +53,31 @@ CREATE TABLE IF NOT EXISTS places ( | |
lon real NOT NULL, | ||
geom geometry | ||
) INHERITS(lifecycle); | ||
|
||
DROP TRIGGER IF EXISTS updated_at_places on places; | ||
CREATE TRIGGER updated_at_places BEFORE UPDATE ON places FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column(); | ||
|
||
CREATE INDEX place_geo_index ON places USING GIST (geom); | ||
|
||
CREATE TABLE IF NOT EXISTS osmPlaces ( | ||
id SERIAL PRIMARY KEY, | ||
osm_id text NOT NULL, | ||
tags json NOT NULL, | ||
lat real NOT NULL, | ||
lon real NOT NULL, | ||
network integer REFERENCES networks (id) NOT NULL, | ||
geom geometry | ||
) INHERITS(lifecycle); | ||
|
||
DROP TRIGGER IF EXISTS updated_at_osmPlaces on osmPlaces; | ||
CREATE TRIGGER updated_at_osmPlaces BEFORE UPDATE ON osmPlaces FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column(); | ||
|
||
|
||
|
||
-- INDEXES | ||
DROP INDEX IF EXISTS place_geo_index; | ||
CREATE INDEX place_geo_index ON places USING GIST (geom); | ||
|
||
DROP INDEX IF EXISTS osmPlace_geo_index; | ||
CREATE INDEX osmPlace_geo_index ON osmPlaces USING GIST (geom) | ||
|
||
|
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,3 +1,4 @@ | ||
-- Destruction -- | ||
DROP TABLE IF EXISTS networks CASCADE; | ||
DROP TABLE IF EXISTS places CASCADE; | ||
DROP TABLE IF EXISTS osmplaces CASCADE; |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env node | ||
|
||
"use strict"; | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
|
||
var generateSqlDefinition = require('sql-generate'); | ||
|
||
var PRIVATE = require('../../../PRIVATE.json'); | ||
var conString = 'postgres://'+ PRIVATE.pg_user + ':' + PRIVATE.pg_pwd + '@localhost:5432/' + PRIVATE.db_name; | ||
|
||
|
||
module.exports = function(){ | ||
console.log('== Generating definitions =='); | ||
|
||
return new Promise(function(resolve, reject){ | ||
generateSqlDefinition({ dsn: conString }, function(err, definitions) { | ||
if (err) | ||
reject('Coudn\'t generate definitions: ' + err); | ||
|
||
fs.writeFileSync(path.join(__dirname, './declarations.js'), definitions.buffer); | ||
console.log('Definitions generated'); | ||
resolve(); | ||
}); | ||
|
||
process.on('uncaughtException', function(err) { | ||
reject('Coudn\'t generate definitions, caught exception: ', err); | ||
}); | ||
}); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
es-lint unadapted :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll clean my own lint mess :p