3

Every two years when I upgrade to the latest debian stable I start from scratch with my elevation contours pgsql/postgis database. This year I spent an entire day trying to find some new combination of work flow that would allow me to import the data successfully. My old work flow goes like this:

  1. unzip srtm3 data
  2. create osm file using phyghtmap version 1.47
  3. import osm to pgsql db using the following command:

    osm2pgsql -d contours --style [path to style file] (add -a for subsequent imports)

(with osm2pgsql v0.92) I first ran into memory issues, which forced me to use -C (cache) and -s (slim) options. The first file imported ok, but the next one took 300 some seconds at 0.4k/s. If you assume 1 osm file for each of the 550 srtm3 zip files to be converted/imported this works out to over 45 hours. Actually, it would take much longer since phyghtmap spits out sometimes 5 or so osm files for a given zip archive. So this is not feasible, and this process used to take me only 6-7 hours with older versions of osm2pgsql. So after a day of trying everything I could think of including combining the osm files prior to import using osmconvert and osmosis (this resulted in garbled data verified in qgis), I gave up and went searching for an older version of osm2pgsql. I compiled version 0.86 from source, and bam, I was back on track with my old work flow.

So finally my question is this: is the old behavior of osm2pgsql gone forever or can we resurect it just as a cli switch? It seems to me the problem is all the indexing that is being done on each import, but I do not see any switches that allow that behavior to be turned off.

nomadicME
  • 203
  • 2
  • 5
  • Since SRTM data does not change, I wonder why you don't save the contour data to a good GIS format once (e.g. to spatialite), and import that to postgis when you upgrade. – AndreJ Jun 24 '17 at 05:30
  • lack of knowledge. I think you can use qgis for such a task, but the number of files makes it impractical. Can you suggest a cli tool that can import osm into spatialite? And another from spatialite into pgsql? Thanks. – nomadicME Jun 24 '17 at 06:15
  • ogr2ogr can do.You can find lots of examples at SE, even for batch processing. Besides, you don't need osm format to create contours from a DEM: https://gis.stackexchange.com/questions/15076/generating-contours-from-dem-using-gdal – AndreJ Jun 24 '17 at 11:50

0 Answers0