I’m trying to import the entire planet OSM (OpenStreetMap) data into a PostGIS database using GDAL and ogr2ogr. However, this process has been running for 6 days, and it’s still not finished.
Here’s what I’m doing:
I’m using the .pbf format of the planet OSM data. I'm using GDAL’s ogr2ogr tool to import the data into PostGIS. My PostGIS extension is installed and functioning in the database.
My questions:
And this is my code
public void UploadFile(string dosyaAdi, string veriTabani)
{
string klasorYolu = @"D:\osm\";
string filePath = Path.Combine(klasorYolu, dosyaAdi);
Process process1 = new Process();
process1.StartInfo.FileName = @"C:\Program Files\QGIS 3.28.3\OSGeo4W.bat";
string abc = $"PG:\"dbname={veriTabani} user=postgres password=12345 host=localhost\"";
process1.StartInfo.Arguments = $@"ogr2ogr -f ""PostgreSQL"" {abc} -lco GEOMETRY_NAME=geom {filePath}";
process1.StartInfo.UseShellExecute = false;
process1.StartInfo.RedirectStandardOutput = false;
process1.StartInfo.RedirectStandardError = false;
process1.Start();
process1.WaitForExit();
}
Importing planet scale OSM is expected to take a very long time. But you would have likely a better experience using https://osm2pgsql.org/ which is dedicated to this task. The GDAL OSM driver uses a temporary SQLite database to be able to work with any output format.