Index: src/common/bin/gdal2tiles-gnuboat.py
===================================================================
--- src/common/bin/gdal2tiles-gnuboat.py	(revision 9f5877dc45dcf00238a6d2e688fcc536e3373191)
+++ src/common/bin/gdal2tiles-gnuboat.py	(revision 096625e75e7638a2de88490a06726a69da65730b)
@@ -2,5 +2,5 @@
 # -*- coding: utf-8 -*-
 # ******************************************************************************
-#  $Id: gdal2tiles.py 17c3fa6fefeb3b305a27ff6ed1590145815d7ee3 2019-03-14 22:12:27 +0100 Even Rouault $
+#  $Id: gdal2tiles.py fae3a65f16af509cf9e0dd16cd16858d8e49eb25 2019-03-12 15:23:57 -0700 Kevin Mehall $
 #
 # Project:  Google Summer of Code 2007, 2008 (http://code.google.com/soc/)
@@ -41,6 +41,5 @@
 
 import math
-from multiprocessing import Pool
-from functools import partial
+from multiprocessing import Pipe, Pool, Process, Manager
 import os
 import tempfile
@@ -63,5 +62,5 @@
     numpy_available = False
 
-__version__ = "$Id: gdal2tiles.py 17c3fa6fefeb3b305a27ff6ed1590145815d7ee3 2019-03-14 22:12:27 +0100 Even Rouault $"
+__version__ = "$Id: gdal2tiles.py fae3a65f16af509cf9e0dd16cd16858d8e49eb25 2019-03-12 15:23:57 -0700 Kevin Mehall $"
 
 resampling_list = ('average', 'near', 'bilinear', 'cubic', 'cubicspline', 'lanczos', 'antialias')
@@ -703,5 +702,4 @@
             input_srs.ImportFromWkt(input_srs_wkt)
 
-    input_srs.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
     return input_srs, input_srs_wkt
 
@@ -712,5 +710,4 @@
     """
     output_srs = osr.SpatialReference()
-    output_srs.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
 
     if options.profile == 'mercator':
@@ -896,5 +893,5 @@
     return dataset.RasterCount
 
-def create_base_tile(tile_job_info, tile_detail):
+def create_base_tile(tile_job_info, tile_detail, queue=None):
 
     dataBandsCount = tile_job_info.nb_data_bands
@@ -999,4 +996,6 @@
                 ).encode('utf-8'))
 
+    if queue:
+        queue.put("tile %s %s %s" % (tx, ty, tz))
 
 
@@ -1527,5 +1526,4 @@
         srs4326 = osr.SpatialReference()
         srs4326.ImportFromEPSG(4326)
-        srs4326.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
         if self.out_srs and srs4326.ExportToProj4() == self.out_srs.ExportToProj4():
             self.kml = True
@@ -2752,10 +2750,27 @@
 
 
-def worker_tile_details(input_file, output_folder, options):
-      gdal2tiles = GDAL2Tiles(input_file, output_folder, options)
-      gdal2tiles.open_input()
-      gdal2tiles.generate_metadata()
-      tile_job_info, tile_details = gdal2tiles.generate_base_tiles()
-      return tile_job_info, tile_details
+def worker_tile_details(input_file, output_folder, options, send_pipe=None):
+    try:
+        gdal2tiles = GDAL2Tiles(input_file, output_folder, options)
+        gdal2tiles.open_input()
+        gdal2tiles.generate_metadata()
+        tile_job_info, tile_details = gdal2tiles.generate_base_tiles()
+        return_data = (tile_job_info, tile_details)
+        if send_pipe:
+            send_pipe.send(return_data)
+
+        return return_data
+    except Exception as e:
+        print("worker_tile_details failed ", str(e))
+
+
+def progress_printer_thread(queue, nb_jobs):
+    pb = ProgressBar(nb_jobs)
+    pb.start()
+    for _ in range(nb_jobs):
+        queue.get()
+        pb.log_progress()
+        queue.task_done()
+
 
 class ProgressBar(object):
@@ -2799,8 +2814,6 @@
         srs4326 = osr.SpatialReference()
         srs4326.ImportFromEPSG(4326)
-        srs4326.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
         if tile_job_info.kml and tile_job_info.in_srs_wkt:
             in_srs = osr.SpatialReference()
-            in_srs.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
             in_srs.ImportFromWkt(tile_job_info.in_srs_wkt)
             ct = osr.CoordinateTransformation(in_srs, srs4326)
@@ -2863,26 +2876,37 @@
     os.environ['GDAL_CACHEMAX'] = '%d' % int(gdal.GetCacheMax() / nb_processes)
 
-    pool = Pool(processes=nb_processes)
+    (conf_receiver, conf_sender) = Pipe(False)
 
     if options.verbose:
         print("Begin tiles details calc")
-
-    conf, tile_details = pool.apply(worker_tile_details, [input_file, output_folder, options])
-
+    p = Process(target=worker_tile_details,
+                args=[input_file, output_folder, options],
+                kwargs={"send_pipe": conf_sender})
+    p.start()
+    # Make sure to consume the queue before joining. If the payload is too big, it won't be put in
+    # one go in the queue and therefore the sending process will never finish, waiting for space in
+    # the queue to send data
+    conf, tile_details = conf_receiver.recv()
+    p.join()
     if options.verbose:
         print("Tiles details calc complete.")
-        
-    if not options.verbose and not options.quiet:
-        progress_bar = ProgressBar(len(tile_details))
-        progress_bar.start()
-
+    # Have to create the Queue through a multiprocessing.Manager to get a Queue Proxy,
+    # otherwise you can't pass it as a param in the method invoked by the pool...
+    manager = Manager()
+    queue = manager.Queue()
+    pool = Pool(processes=nb_processes)
     # TODO: gbataille - check the confs for which each element is an array... one useless level?
     # TODO: gbataille - assign an ID to each job for print in verbose mode "ReadRaster Extent ..."
-    for _ in pool.imap_unordered(partial(create_base_tile, conf), tile_details, chunksize=128):
-        if not options.verbose and not options.quiet:
-            progress_bar.log_progress()
+    for tile_detail in tile_details:
+        pool.apply_async(create_base_tile, (conf, tile_detail), {"queue": queue})
+
+    if not options.verbose and not options.quiet:
+        p = Process(target=progress_printer_thread, args=[queue, len(tile_details)])
+        p.start()
 
     pool.close()
     pool.join()     # Jobs finished
+    if not options.verbose and not options.quiet:
+        p.join()        # Traces done
 
     create_overview_tiles(conf, output_folder, options)
