I'm trying to set up my own Rails Port OSM API server as my application needs to make a very large number of map queries. I finally have everything looking like it should work but when I query a region of the map that has been populated from a .osm file using osm2pgsql I just get the wrapper nodes with no actual content returned. It's as though the region I'm querying has not been populated with data. The details: I'm using an Ubuntu 16.04 running on a Virtual Machine. I followed all steps described here: https://github.com/openstreetmap/openstreetmap-website/blob/master/INSTALL.md . But I had to change a few things due to version and package name changes. So I ended up installing these:
I got error messages later on in the process regarding not having svgo installed, so I also ended up installing this to get rid of the errors:
To fix some other errors I got when trying to run osm2pgsql I found I had to add PostGIS support to database:
I got hold of the Bonn, Germany .osm.bz2 file from mapzen.com/data/metro-extracts/ I populated this into the database:
I carefully examined the log generated and there were no errors and the import seemed to be successful. I started the Rails Port webserver: bundle exec rails server From a webpage on the same PC I did a REST query for a small region that is inside Bonn:
I got a response so I know the server is running, but the response just contained the following:
So I'm just getting the wrapper nodes with no data for the region inside the bounding box. If I make the same query to the public server:
Then I get a long list of nodes and ways from inside the bounding box as expected. Any idea what I am doing wrong? Thanks asked 06 Aug '16, 01:45 techtonic |
The rails port uses a database schema that is different from osm2pgsql's, hence osm2pgsql is the wrong tool to use if you want to populate a database for use with the rails port. You must use osmosis with the "APIDB" schema instead. answered 06 Aug '16, 21:30 Frederik Ramm ♦ Thanks, I was not aware of that and it sounds like a probable cause of my problem. I did try using Osmosis to import a few times but had trouble getting it to connect to the postgresql database. I will try again when I get back to work next week.
(07 Aug '16, 07:20)
techtonic
I finally got osmosis to connect to database by removing password requirement from pg_hba.conf. Importing the same .osm file with osmosis works and now I am getting valid data returned :) Thanks for the help!
(08 Aug '16, 21:02)
techtonic
|
Setting up a rails port just for a number of map calls seems to be quite a lot of overhead to me. I would possibly suggest to set up your own Overpass API instance and use the map call available there. I may be a bit biased, though... Can you shed some light on how many calls you're planning to run per minute and what your coverage area looks like?
@mmd I need to perform a map query to get the nodes and ways (not interested in image tiles) on an array of approx 2km x 2km tiles covering most of central Europe. Plus we need to edit the database locally using other GIS tools in ways that would not be beneficial to the OSM community, so it would not be right to do it to the public copy. I am definitely looking at Overpass as a possibility for reading the finished map in a more efficient manner. I'm kinda new to OSM so still trying to figure out what is possible.