Failing to create folders on the server
veddycent
Global Mapper User
in User Scripts
Hi all,
I have a script which writes out some files and creates some folders if they don't exist, standard GM functionality.
However it works great when saving locally but when saving on the server it fails to create the folders.
Here is an example directory its fails on:
\\SERVER\Data\Store\Projects\_GM Script Testing\Data\Terrain\HP50SW\OS\HP50SW - OS.png
Everything in bold does not exist and GM is failing to create the folders/file. It does work if the folders exist but this not an option as there are hundreds of unique folders to create.
Here is the full script
=============================================================================
//Loops through a group with SHP files to crop the export too
//Cleans up the SHP filename so we can use it for the exported PNG filename
//Combining all the variables to create the new file directory and filename
//Export the PNG
GM Version 19.1 and 20.1
Any help would be much appreciated!
Thanks
I have a script which writes out some files and creates some folders if they don't exist, standard GM functionality.
However it works great when saving locally but when saving on the server it fails to create the folders.
Here is an example directory its fails on:
\\SERVER\Data\Store\Projects\_GM Script Testing\Data\Terrain\HP50SW\OS\HP50SW - OS.png
Everything in bold does not exist and GM is failing to create the folders/file. It does work if the folders exist but this not an option as there are hundreds of unique folders to create.
Here is the full script
=============================================================================
//Prompt user where to save all the files (pasting the directory is easier than navigation to a folder)
DEFINE_VAR NAME="PROJECT_LOCATION" VALUE="" PROMPT=YES PROMPT_TEXT="Paste project data folder directory: "
//Loops through a group with SHP files to crop the export too
LAYER_LOOP_START FILENAME="SHP<sub>*.shp"
//Gets the tile ID so we can use for the new folder name
DEFINE_VAR NAME="TERRAIN_TILE" VALUE="%LAYER_FNAME_WO_EXT%" REPLACE_STR=" - Terrain="
//Cleans up the SHP filename so we can use it for the exported PNG filename
DEFINE_VAR NAME="SAVE_IMAGE_NAME" VALUE="%LAYER_FNAME_WO_EXT%" REPLACE_STR="Terrain=OS"
//Combining all the variables to create the new file directory and filename
DEFINE_VAR NAME="SAVE_IMAGE_DIR" VALUE="%PROJECT_LOCATION%\Terrain\%TERRAIN_TILE%\OS\%SAVE_IMAGE_NAME%.png"
//Export the PNG
EXPORT_RASTER FILENAME="%SAVE_IMAGE_DIR%" TYPE="PNG" POLYGON_CROP_FILE="%LAYER_FNAME_W_DIR%" OVERWRITE_EXISTING="NO" SPATIAL_RES_METERS="2,2" GEN_WORLD_FILE="YES" GEN_PRJ_FILE="YES" BG_TRANSPARENT="NO"
LAYER_LOOP_END
=============================================================================GM Version 19.1 and 20.1
Any help would be much appreciated!
Thanks
Answers
-
I should include the errors I get:WARNING: Unable to generate RGB PNG file \\SERVER\Data\Store\Projects\_GM Script Testing\Data\Terrain\HP50NW\OS\HP50NW - OS.pngUnable to create file \\SERVER\Data\Store\Projects\_GM Script Testing\Data\Terrain\HP50NW\OS\HP50NW - OS.pngpngoverlay.cpp - 643Version: v20.1.0 (69) (64-bit)Build Time: Feb 25 2019 15:30:00Thread: Main UI ThreadLast Op: File: f:\development_20.1\globalmapper\mapcatalogoverlay.cpp : 1791Windows 10 Pro (64-bit) Memory: 27,107,831,808 of 34,305,908,736 available, GDI Usage: 373 GDI (Peak 504), 158 User (Peak 273)
-
Spaces in file or pathnames are usually a problem requiring special handling. Can you remove them?
-
Unfortunately not. I don't think its spaces as Global Mapper (GM) exports if the directory exists.
As a work around I create a txt file from GM with a list of all the desired directories then run it through a Powershell script to create them. Then export the data from GM which works just fine.
Its a pretty quick extra step so not an issue.
Hopefully the devs see this and fix it as its common functionality. -
Hello,
I ran a quick test in the Global Mapper 22.1 beta, and ran into the same problem you are having. I opened issue GM-11936 to resolve this problem.
As a workaround, I found that if I mapped a drive letter to the existing folder on the server, and used the drive letter in the script, Global Mapper created the folders successfully.
Cheers,
Bob -
Hello,
The fix for GM-11936 will be in Global Mapper 22.1, though it is not in the current beta.
Cheers,
Bob
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 346 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 639 GM Script Language
- 54 User Scripts
- 115 GPS Features
- 417 Projection Questions
- 829 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 920 Bug Report
- 559 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 573 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 241 How I use Global Mapper
- 108 Global Mapper Forum Website