A simple VBA script for batch dumping CorelDRAW files to a lower version.
Sub Resave()
'remember to add a trailing '\', for example c:\my\path\
Dim fld As String
fld = "c:\my\path\"
'make the out fld different than the main fld if needed
'files are saved with a new name, so original ones will not be overwritten
'remember to add a trailing '\', for example c:\my\path\
Dim outFld As String
outFld = "c:\my\path\out\"
If Len(dir(outFld, vbDirectory)) = 0 Then
MkDir outFld
End If
Dim file As String
Dim sopts As StructSaveAsOptions
Set sopts = CreateStructSaveAsOptions
With sopts
'looks like vba is happy to save down to v1...
'x7 is not happy to reopen them though and the lowest version it is happy with is v12
'in the gui the lowest save as version is 11 though
.Version = cdrVersion12
.Overwrite = True
.EmbedVBAProject = True
.Filter = cdrCDR
.IncludeCMXData = False
.Range = cdrAllPages
.EmbedICCProfile = True
.KeepAppearance = True
End With
file = dir(fld & "*.cdr")
Do While file <> ""
Dim doc As Document
Set doc = OpenDocument(fld & file)
doc.SaveAs outFld & Replace(file, ".cdr", "_v" & sopts.Version & ".cdr"), sopts
doc.Close
file = dir()
Loop
End Sub
19. September 2014
mika
GIS
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
19. September 2014
mika
GIS
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
Note: This post is a little excerpt from our GeoServer training.
In order to get Apache Tomcat up and running as a service on windows just do the following:
More...
29. August 2014
mika
garbage , GIS , manifold
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.