Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to run the following bat file from a MS4W shell which has as the final option. I have added C:\ms4w\python\gdal to my pythonpath but within a pyscripter shell I can not import gdal or

Without a linux box is there a way to get the final step to work?

CODE of P.bat File

mkdir -p %2\%3
gdal_translate -expand rgba -of GTiff -a_srs EPSG:3857 -co TILED=YES -co BIGTIFF=YES %1 %2\%3\%3_translated.tif
gdalwarp -multi --config GDAL_CACHEMAX 500 -wm 500 -r near -co "COMPRESS=DEFLATE" -co "TILED=YES" -co "BIGTIFF=YES" -srcnodata 255 -dstnodata 255 -overwrite %2\%3\%3_translated.tif %2\%3\%3_rebuilt.tif
mkdir -p %2\%3\pyramids -v -r bilinear -levels 4 -ps 2048 2048 -co "TILED=YES" -co "COMPRESS=DEFLATE" -targetDir %2\pyramids %2\%3\%3_rebuilt.tif


OUTPUT of process

GDAL, mapserv, mapcache, PROJ, and shapelib dll paths set GDAL_DATA path set GDAL_DRIVER_PATH set PROJ_LIB set CURL_CA_BUNDLE set C:\Users\georgec\Desktop>P:\2012\183_TownPlanning_Symbology\Working\Raster_Layer _Creation\4Band_translated_pyramid\p.bat P:\2012\183_TownPlanning_Symbology\Outp ut\8_Bit_TIF_Colourmap_RS\TRC_WC_WaterResource_Catchment\TRC_WC_WaterResourceCat chment.tif P:\2012\183_TownPlanning_Symbology\Working\Raster_Layer_Creation\4Ban d_translated_pyramid wc

C:\Users\georgec\Desktop>mkdir -p P:\2012\183_TownPlanning_Symbology\Working\Ras ter_Layer_Creation\4Band_translated_pyramid\wc

C:\Users\georgec\Desktop>gdal_translate -expand rgba -of GTiff -a_srs EPSG:3857 -co TILED=YES -co BIGTIFF=YES P:\2012\183_TownPlanning_Symbology\Output\8_Bit_TI F_Colourmap_RS\TRC_WC_WaterResource_Catchment\TRC_WC_WaterResourceCatchment.tif P:\2012\183_TownPlanning_Symbology\Working\Raster_Layer_Creation\4Band_translate d_pyramid\wc\wc_translated.tif Input file size is 19844, 26300 0...10...20...30...40...50...60...70...80...90...100 - done.

C:\Users\georgec\Desktop>gdalwarp -multi --config GDAL_CACHEMAX 500 -wm 500 -r n ear -co "COMPRESS=DEFLATE" -co "TILED=YES" -co "BIGTIFF=YES" -srcnodata 255 -dst nodata 255 -overwrite P:\2012\183_TownPlanning_Symbology\Working\Raster_Layer_Cr eation\4Band_translated_pyramid\wc\wc_translated.tif P:\2012\183_TownPlanning_Sy mbology\Working\Raster_Layer_Creation\4Band_translated_pyramid\wc\wc_rebuilt.tif

Creating output file that is 19844P x 26300L. Processing input file P:\2012\183_TownPlanning_Symbology\Working\Raster_Layer_Cr eation\4Band_translated_pyramid\wc\wc_translated.tif. Using band 4 of source image as alpha. Using band 4 of destination image as alpha. 0...10...20...30...40.ERROR 2: Out of memory allocating 130520448 bytes for Unif iedSrcDensity mask. ..50.. C:\Users\georgec\Desktop>mkdir -p P:\2012\183_TownPlanning_Symbology\Working\Ras ter_Layer_Creation\4Band_translated_pyramid\wc\pyramids A subdirectory or file -p already exists. Error occurred while processing: -p.

C:\Users\georgec\Desktop> -v -r bilinear -levels 4 -ps 2048 2048 - co "TILED=YES" -co "COMPRESS=DEFLATE" -targetDir P:\2012\183_TownPlanning_Symbol ogy\Working\Raster_Layer_Creation\4Band_translated_pyramid\pyramids P:\2012\183_ TownPlanning_Symbology\Working\Raster_Layer_Creation\4Band_translated_pyramid\wc \wc_rebuilt.tif Traceback (most recent call last): File "C:\ms4w\python\gdal\", line 38, in import gdal ImportError: No module named gdal

C:\Users\georgec\Desktop>Pause Press any key to continue . . .

I also get the following Error

ERROR 2: Out of memory allocating 130520448 bytes for Unif iedSrcDensity mask

share|improve this question
How much memory you got on C:\? – Kelso Nov 22 '12 at 3:11
930GB on C and 350gb on D (this is free space off 1TB drives) and they are running 16GB RAM on XEON 3.4GHz. Windows 7, 65-bit. – GeorgeC Nov 22 '12 at 4:19
What about the P: drive – Kelso Nov 22 '12 at 4:40
1.72TB free...these are network drives with plenty of space. – GeorgeC Nov 22 '12 at 4:41
up vote 0 down vote accepted

I tried it in the OSGEO4W shell and works fine. However I am getting out of memory errors on larger files in the 2nd stage gdal_warp.

See new question if you want to help! VSIMalloc3() and UnifiedSrcDensity mask errors when running gdal_warp in OSGEO4w shell


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.