GlobalMapper - batch reproject and export geotif to ecw

A simple GlobalMapper script that iterates through all the tiff files in a specified directory, and exports them to ecw in EPSG 2180, 3857 and 4326.

//Exports all the tif files found in the source dir to ecw.
//Reprojects the data to 2180, 3857 and 4326 and the exports it to the appropriate folders

GLOBAL_MAPPER_SCRIPT VERSION=1.00

//Define in / out folders
DEFINE_VAR NAME=source_dir VALUE="C:\here\goes\input\path"
DEFINE_VAR NAME=target_dir VALUE="C:\here\goes\output\path"

//start the loop to iterate through all the files
DIR_LOOP_START DIRECTORY="%source_dir%" FILENAME_MASKS="*.tif" RECURSE_DIR=NO
	//Import the file
	IMPORT FILENAME="%FNAME_W_DIR%"
	
	//assign projection 4326
	LOAD_PROJECTION PROJ=4326
	EXPORT_RASTER FILENAME="%target_dir%\4326\%FNAME_WO_EXT%.ecw" TYPE=ECW BG_TRANSPARENT=YES FORCE_SQUARE_PIXELS=YES
		
	//assign projection 2180
	//Note: gm seems to not properly load 2180, so reading the proj def from a file
	LOAD_PROJECTION FILENAME="%source_dir%\2180.prj"
	EXPORT_RASTER FILENAME="%target_dir%\2180\%FNAME_WO_EXT%.ecw" TYPE=ECW BG_TRANSPARENT=YES FORCE_SQUARE_PIXELS=YES
	
	//assign projection 3857
	//Note: gm seems to not properly load neither 3857 not 900913, so reading the proj def from a file
	LOAD_PROJECTION FILENAME="%source_dir%\3857.prj"
	EXPORT_RASTER FILENAME="%target_dir%\3857\%FNAME_WO_EXT%.ecw" TYPE=ECW BG_TRANSPARENT=YES FORCE_SQUARE_PIXELS=YES
	
	//Unload the loaded data
	UNLOAD_ALL

// End the loop
DIR_LOOP_END

GDAL - assign a projection to a tif

per file:

gdalwarp -t_srs "EPSG:4326" input.tif output.tif

and a batch:

@echo off
mkdir processed
for %%F in (*.tif) do (
	echo processing %%F
	gdalwarp -t_srs "EPSG:4326" %%F processed\%%F
)
pause

GIS rocks...

Just digged out some data examples i worked with at the museum of zoology long time ago...

A simple visualisation of a 3d scanner data dumped to a an xyz txt file.

Spatial index in postgis

--create geom index
CREATE INDEX mytable_geom_gist
  ON public.mytable
  USING GIST (geometry);

--vacuum analyze
VACUUM ANALYZE public.mytable;