Script producing different results in GM 13.1.x and 13.2.0
tjhb
Global Mapper UserTrusted User
Mike,
I have a script I've used (with variations as you've added new features) in several versions of Global Mapper to rasterize vector data to GeoTIFF, splitting output by tile (using POLYGON_CROP_FILE, POLYGON_CROP_USE_EACH, POLYGON_CROP_NAME_ATTR and POLYGON_CROP_FOLDER_ATTR).
It has worked consistently up until version 13.1.3, but stopped working as expected (by me) with 13.2.0.
Under version 13.1.3 (installer dated 29 March 2012) the log file reads like this, and I get output for each of the 17 tiles in my grid of areas (%AOI%).
With the same test data, under 13.2.0 (installer dated 17 May 2012) the log shows this, and I get no output.
The script is below (and attached). Am I missing something obvious?
(I can supply test data if you like.)
Rasterize shapefiles to tiles (lines, 4px solid).gms
I have a script I've used (with variations as you've added new features) in several versions of Global Mapper to rasterize vector data to GeoTIFF, splitting output by tile (using POLYGON_CROP_FILE, POLYGON_CROP_USE_EACH, POLYGON_CROP_NAME_ATTR and POLYGON_CROP_FOLDER_ATTR).
It has worked consistently up until version 13.1.3, but stopped working as expected (by me) with 13.2.0.
Under version 13.1.3 (installer dated 29 March 2012) the log file reads like this, and I get output for each of the 17 tiles in my grid of areas (%AOI%).
Removed all loaded overlays.
Loading new global projection...
Loading style file...
Starting loop over all files in directory...
Importing file \{Input}\Lines 4px\wharf_edge.shp...
Exporting raster data to file \{Output}\wharf_edge_.tif...
Loop over files in directory completed.
Removed all loaded overlays.
Script processing COMPLETED.
With the same test data, under 13.2.0 (installer dated 17 May 2012) the log shows this, and I get no output.
Removed all loaded overlays.
Loading new global projection...
Loading style file...
Starting loop over all files in directory...
Importing file \{Input}\Lines 4px\wharf_edge.shp...
Exporting raster data to file \{Output}\wharf_edge_.tif...
ERROR: Export bounds empty for EXPORT_RASTER command.
ERROR: No raster data found for EXPORT_RASTER command.
Loop over files in directory completed.
Removed all loaded overlays.
Script processing COMPLETED.
The script is below (and attached). Am I missing something obvious?
(I can supply test data if you like.)
GLOBAL_MAPPER_SCRIPT VERSION=1.00
// Rasterize line shapefiles, splitting by AOI tile
// * Updated for GM 13.x *
DEFINE_VAR NAME="AOI" \
VALUE="D:\{Input}\AOI\Grid 65536m (overlapped) land.shp"
//VALUE="D:\{Input}\AOI\Grid 65536m (overlapped) north.shp"
//VALUE="D:\{Input}\AOI\Grid 65536m (overlapped) south.shp"
DEFINE_VAR NAME="OVERWRITE" \
//VALUE="YES" // Default
VALUE="NO"
SET_LOG_FILE \
FILENAME="D:\{Output}\GM lines.txt"
UNLOAD_ALL
// Define source projection
DEFINE_PROJ \
PROJ_NAME="NZTM2000_NZGD2000"
Projection New Zealand Transverse Mercator 2000
Datum NZGD_2000
Zunits NO
Units METERS
Xshift 0.000000
Yshift 0.000000
Parameters
END_DEFINE_PROJ
// Set target projection
LOAD_PROJECTION \
// PROJ_NAME="NZTM2000_NZGD2000" // * Deprecated *
PROJ="NZTM2000_NZGD2000"
// Set background to black
SET_BG_COLOR \
COLOR=RGB(0,0,0)
// Load custom style(s)
LOAD_STYLE_FILE \
FILENAME="D:\{Input}\Line styles.gm_style" \
ADD_UNKNOWN_TYPES=YES
DIR_LOOP_START \
DIRECTORY="D:\{Input}\Lines 4px" \
FILENAME_MASKS="*.SHP" \
RECURSE_DIR=NO
// Import source file and assign source projection
// and style
IMPORT \
FILENAME="%FNAME_W_DIR%" \
TYPE=SHAPEFILE \
// PROJ_NAME="NZTM2000_NZGD2000" \ // * Deprecated *
PROJ="NZTM2000_NZGD2000" \
LINE_TYPE="White 4px solid"
// Rasterize to GeoTIFF, splitting by AOI tile
// with output in named subfolders
EXPORT_RASTER \
FILENAME="D:\{Output}\%FNAME_WO_EXT%_.tif" \
TYPE=GEOTIFF \
// Omit PALETTE option for 24-bit RGB (the default)
PALETTE=BLACKISMIN \
// Specify pixel resolution
// 4.0 mpx
// (18432px per 65536m tile)
SPATIAL_RES=4.0,4.0 \
// Specify target pixel dimensions instead
// PIXEL_SIZE=18432x18432 \
FORCE_SQUARE_PIXELS=YES \
INC_VECTOR_DATA=YES \
// Specify tiling grid
POLYGON_CROP_FILE="%AOI%" \
// Needs a PRJ file
POLYGON_CROP_BBOX_ONLY=NO \
POLYGON_CROP_USE_EACH=YES \
POLYGON_CROP_NAME_ATTR="Name" \
POLYGON_CROP_FOLDER_ATTR="Name" \
// Currently, to use POLYGON_CROP_FOLDER_ATTR
// POLYGON_CROP_NAME_ATTR must also be specified
BG_TRANSPARENT=NO \
DPI=300 \
// TILE_SIZE=256 \
// USE_LZW=YES \ // * Deprecated *
COMPRESSION=LZW \
DISABLE_BIGTIFF=NO \
GEN_WORLD_FILE=YES \
GEN_PRJ_FILE=NO \
OVERWRITE_EXISTING=%OVERWRITE%
// Close source file
UNLOAD_LAYER \
FILENAME="%FNAME%"
DIR_LOOP_END
UNLOAD_ALL
// Reset background to white
SET_BG_COLOR \
COLOR=RGB(255,255,255)
// Rasterize line shapefiles, splitting by AOI tile
// * Updated for GM 13.x *
DEFINE_VAR NAME="AOI" \
VALUE="D:\{Input}\AOI\Grid 65536m (overlapped) land.shp"
//VALUE="D:\{Input}\AOI\Grid 65536m (overlapped) north.shp"
//VALUE="D:\{Input}\AOI\Grid 65536m (overlapped) south.shp"
DEFINE_VAR NAME="OVERWRITE" \
//VALUE="YES" // Default
VALUE="NO"
SET_LOG_FILE \
FILENAME="D:\{Output}\GM lines.txt"
UNLOAD_ALL
// Define source projection
DEFINE_PROJ \
PROJ_NAME="NZTM2000_NZGD2000"
Projection New Zealand Transverse Mercator 2000
Datum NZGD_2000
Zunits NO
Units METERS
Xshift 0.000000
Yshift 0.000000
Parameters
END_DEFINE_PROJ
// Set target projection
LOAD_PROJECTION \
// PROJ_NAME="NZTM2000_NZGD2000" // * Deprecated *
PROJ="NZTM2000_NZGD2000"
// Set background to black
SET_BG_COLOR \
COLOR=RGB(0,0,0)
// Load custom style(s)
LOAD_STYLE_FILE \
FILENAME="D:\{Input}\Line styles.gm_style" \
ADD_UNKNOWN_TYPES=YES
DIR_LOOP_START \
DIRECTORY="D:\{Input}\Lines 4px" \
FILENAME_MASKS="*.SHP" \
RECURSE_DIR=NO
// Import source file and assign source projection
// and style
IMPORT \
FILENAME="%FNAME_W_DIR%" \
TYPE=SHAPEFILE \
// PROJ_NAME="NZTM2000_NZGD2000" \ // * Deprecated *
PROJ="NZTM2000_NZGD2000" \
LINE_TYPE="White 4px solid"
// Rasterize to GeoTIFF, splitting by AOI tile
// with output in named subfolders
EXPORT_RASTER \
FILENAME="D:\{Output}\%FNAME_WO_EXT%_.tif" \
TYPE=GEOTIFF \
// Omit PALETTE option for 24-bit RGB (the default)
PALETTE=BLACKISMIN \
// Specify pixel resolution
// 4.0 mpx
// (18432px per 65536m tile)
SPATIAL_RES=4.0,4.0 \
// Specify target pixel dimensions instead
// PIXEL_SIZE=18432x18432 \
FORCE_SQUARE_PIXELS=YES \
INC_VECTOR_DATA=YES \
// Specify tiling grid
POLYGON_CROP_FILE="%AOI%" \
// Needs a PRJ file
POLYGON_CROP_BBOX_ONLY=NO \
POLYGON_CROP_USE_EACH=YES \
POLYGON_CROP_NAME_ATTR="Name" \
POLYGON_CROP_FOLDER_ATTR="Name" \
// Currently, to use POLYGON_CROP_FOLDER_ATTR
// POLYGON_CROP_NAME_ATTR must also be specified
BG_TRANSPARENT=NO \
DPI=300 \
// TILE_SIZE=256 \
// USE_LZW=YES \ // * Deprecated *
COMPRESSION=LZW \
DISABLE_BIGTIFF=NO \
GEN_WORLD_FILE=YES \
GEN_PRJ_FILE=NO \
OVERWRITE_EXISTING=%OVERWRITE%
// Close source file
UNLOAD_LAYER \
FILENAME="%FNAME%"
DIR_LOOP_END
UNLOAD_ALL
// Reset background to white
SET_BG_COLOR \
COLOR=RGB(255,255,255)
Rasterize shapefiles to tiles (lines, 4px solid).gms
Comments
-
If you can provide a sample .shp file that generates that output I can take a look. Is it possible the SHP file is empty?
Thanks,
Mike
Global Mapper Guru
gmsupport@bluemarblegeo.com
http://www.globalmapper.com -
Mike,
I've attached a source folder (zipped) and a script.
I switched the source vectors from lines to areas (more visible, when it works). The script is slightly different accordingly.
As before the script expects source files under \{Input}. You've made it straightforward to edit for a different target so I hope this isn't a bother.
I appreciate your taking a look. Thanks.
Rasterize shapefiles to tiles (areas north 4).gms
{Input}.zip
Tim -
Tim,
I forgot someone else already reported this bug in v13.2 and I fixed it a week ago! I have placed a new build at http://www.globalmapper.com/global_mapper13.zip with the latest changes for you to try. Simply download that file and extract the contents into your existing v13.xx installation folder to give it a try. If you are using the 64-bit v13 version there is a new build at http://www.globalmapper.com/global_mapper13_64bit.zip .
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Guru
gmsupport@bluemarblegeo.com
http://www.globalmapper.com -
Thanks Mike, that indeed has restored the functionality to normal.
Or almost!
I notice that folders are now created for all possible outputs in advance (for each object in the POLYGON_CROP_FILE), whereas previously each folder was created only as and if it was needed.
Now, if there is no data within a given cropping area, the corresponding output folder remains empty.
I preferred the previous behaviour--but perhaps only because I was used to it. You may have made the change for efficiency or for some other advantage. I'm curious.
Tim -
Tim,
I fixed the issue with the folder creation prior to export. I have placed a new build at http://www.globalmapper.com/global_mapper13.zip with the latest changes for you to try. Simply download that file and extract the contents into your existing v13.xx installation folder to give it a try. If you are using the 64-bit v13 version there is a new build at http://www.globalmapper.com/global_mapper13_64bit.zip .
Thanks,
Mike
Global Mapper Guru
gmsupport@bluemarblegeo.com
http://www.globalmapper.com -
Mike thanks, I really like the way this works now. Perfectly.
Tim
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website