Created
November 23, 2016 19:59
-
-
Save hneiva/2daf0814a80868b2e7f74f4ec240e5dc to your computer and use it in GitHub Desktop.
Commands to start a new OpenStreetMap database on AWS RDS Postgres (copy/paste version)
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
-- Create extensions | |
create extension postgis; | |
create extension hstore; | |
create extension fuzzystrmatch; | |
create extension postgis_tiger_geocoder; | |
create extension postgis_topology; | |
-- Change owner of schemas | |
alter schema tiger owner to rds_superuser; | |
alter schema topology owner to rds_superuser; | |
-- Transfer ownership of the objects to the rds_superuser role | |
CREATE FUNCTION exec(text) returns text language plpgsql volatile AS $f$ BEGIN EXECUTE $1; RETURN $1; END; $f$; | |
SELECT exec('ALTER TABLE ' || quote_ident(s.nspname) || '.' || quote_ident(s.relname) || ' OWNER TO rds_superuser;') | |
FROM ( | |
SELECT nspname, relname | |
FROM pg_class c JOIN pg_namespace n ON (c.relnamespace = n.oid) | |
WHERE nspname in ('tiger','topology') AND | |
relkind IN ('r','S','v') ORDER BY relkind = 'S') | |
s; | |
SET search_path=public,tiger; | |
-- The following queries are just to make sure it's all working, but if you didn't get any errors, everything should be good. | |
-- select na.address, na.streetname, na.streettypeabbrev, na.zip from normalize_address('1 Devonshire Place, Boston, MA 02109') as na; | |
-- select topology.createtopology('my_new_topo',26986,0.5); | |
-- Now the database is ready to load any OSM data | |
-- I recommend using http://wiki.openstreetmap.org/wiki/Osm2pgsql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment