简体   繁体   中英

How can I automatically load a OSM data set into my rails postgresql db on rake db:create or migrate

I am using Open Streetmap Data in my rails app. I have downloaded the relevant data as a .osm and can import that data into my db using osm2pgsql. So far no problem.

But how can i arrange the data to be imported automatically when I create the database? For example when I move the app to a production server, or when I just want to reset the database via db:drop.

Any help is appreciated. Cheers, Martin

You can add it to your db/seeds.rb file.

Check this Railscast for an insight. You probably will need to invoke the osm2pgsql from the command line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM