Specify sampling method for a new grid?
tjhb
Global Mapper UserTrusted User
Is there a way, directly after executing a GENERATE_GRID_FILE command, to specify the sampling method to be used for the new gridded layer?—I'd like to specify bicubic resampling during the following EXPORT_ELEVATION* operation, which involves cropping exactly to a specific AOI.
A workaround would be to export the DEM without cropping (so no interpolation), unload it and reload it (specifying SAMPLING_METHOD at this point), then export a second time with cropping to the AOI. Is that necessary?
[*There doesn't seem to be a way of specifying the sampling method explicitly for the EXPORT_ELEVATION command itself.]
A workaround would be to export the DEM without cropping (so no interpolation), unload it and reload it (specifying SAMPLING_METHOD at this point), then export a second time with cropping to the AOI. Is that necessary?
[*There doesn't seem to be a way of specifying the sampling method explicitly for the EXPORT_ELEVATION command itself.]
Comments
-
I have updated the GENERATE_ELEV_GRID command to support the display option parameters (like for the sample method) that the IMPORT command support, so you can now specify the sampling method to use when generating the grid layer. I have placed a new build at http://www.globalmapper.com/global_mapper12.zip with the change for you to try. Simply download that file and extract the contents into your existing v12.xx installation folder to give it a try. If you are using the 64-bit v12 version there is a new build at http://www.globalmapper.com/global_mapper12_64bit.zip .
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Crikey that's a welcome surprise. I'll test it right away.
(I got the name of GENERATE_ELEV_GRID very wrong. I seem to have been making a lot of mistakes here lately. On this occasion my excuse is that it's Friday evening here.)
Thanks. -
Mike I don't think this is working as expected. The two scripts shown below produce indistinguishable output.
In any case, can I also ask if it would be possible to make the EXPORT_ELEVATION routine implement the value of the GUI setting "Terrain Export: Specify Bounds as Pixel is Area" during export? Currently it seems to use Pixel is Point always.
(It would perhaps be better if EXPORT_ELEVATION had its own ad hoc parameter for the pixel model, but adopting the GUI setting would be enough. Not many people need to change it.)
Script 1, creating a DEM at 2 metres per pixel, applying the bicubic sampling method, then exporting at 0.5 metres:GLOBAL_MAPPER_SCRIPT VERSION=1.00
UNLOAD_ALL
SET_LOG_FILE \
FILENAME="E:\{Output}\GM log.txt"
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
LOAD_PROJECTION \
PROJ_NAME="NZTM2000_NZGD2000"
DIR_LOOP_START \
DIRECTORY="D:\{Input}\SHP\" FILENAME_MASKS="*.SHP" \
RECURSE_DIR=NO
IMPORT \
FILENAME="%FNAME_W_DIR%" TYPE=SHAPEFILE \
PROJ_NAME="NZTM2000_NZGD2000"
GENERATE_ELEV_GRID \
ELEV_UNITS=METERS \
SPATIAL_RES=2.0,2.0 \
NO_DATA_DIST_MULT=50 \
LAYER_DESC="DEM %FNAME_WO_EXT%" \
SAMPLING_METHOD=BICUBIC
EXPORT_ELEVATION \
FILENAME="E:\{Output}\DEM %FNAME_WO_EXT%.flt" \
TYPE=FLOATGRID \
ELEV_UNITS=METERS \
POLYGON_CROP_FILE="D:\{Input}\AOI\%FNAME_WO_EXT%.shp" \
POLYGON_CROP_BBOX_ONLY=NO \
POLYGON_CROP_USE_ALL=YES \
SPATIAL_RES=0.5,0.5 \
FORCE_SQUARE_PIXELS=YES
UNLOAD_LAYER FILENAME="%FNAME%"
DIR_LOOP_ENDSAMPLING_METHOD=NEAREST_NEIGHBOR -
Specifying SAMPLING_METHOD=BICUBIC makes no difference either.
-
I tried this myself and found a problem that was preventing the SAMPLING_METHOD parameter from working right for GENERATE_ELEV_GRID. That is now fixed. I have placed a new build at http://www.globalmapper.com/global_mapper12.zip with the change for you to try. Simply download that file and extract the contents into your existing v12.xx installation folder to give it a try. If you are using the 64-bit v12 version there is a new build at http://www.globalmapper.com/global_mapper12_64bit.zip .
I also updated the export bounds for the EXPORT_ELEVATION script command to be treated as 'pixel is area' if the option to treat elevation bounds that was is checked in the Advanced section of the General tab of the Configuration dialog.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
That looks perfect to me, on both counts.
Thank you very much again Mike.
Tim -
I thought I should say what I was trying to do, that has been made possible by these changes.
The input data was LiDAR points, very finely spaced, covering an area about 80km vertically, and about 5km horizontally at any point.
The LiDAR data was supplied in discrete tiles. If I used GM to make DEMs for each tile (or groups of tiles), then there were ridges or gaps at tile boundaries. (Rightly so.)
If I tried to make a single DEM from all tiles combined, then the memory required was prohibitive. (With 12 GB of physical RAM, Windows 7 64-bit could not cope, despite effectively unlimited swap file space.)
The answer was to make overlapping sets of points, create a DEM from each set, then crop each DEM to its net area, removing the overlap (and with it any edge effect).
To get maximum data fidelity, I needed minimal displacement between DEM pixels as they were created, and after cropping to their net tile area.
The changes above have enabled this workflow.
I don't think I've explained it at all well. Here is my final GM script (unfortunately in italics and without meaningful indentation).GLOBAL_MAPPER_SCRIPT VERSION=1.00
UNLOAD_ALL
SET_LOG_FILE \
FILENAME="E:\{Output}\GM log.txt"
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
LOAD_PROJECTION \
PROJ_NAME="NZTM2000_NZGD2000"
DIR_LOOP_START \
DIRECTORY="D:\{Input}\SHP\" FILENAME_MASKS="*.SHP" \
RECURSE_DIR=NO
IMPORT \
FILENAME="%FNAME_W_DIR%" TYPE=SHAPEFILE \
PROJ_NAME="NZTM2000_NZGD2000"
GENERATE_ELEV_GRID \
ELEV_UNITS=METERS \
SPATIAL_RES=0.5,0.5 \
NO_DATA_DIST_MULT=250 \
LAYER_DESC="DEM %FNAME%" \
SAMPLING_METHOD=BICUBIC
EXPORT_ELEVATION \
FILENAME="E:\{Output}\DEM %FNAME_WO_EXT%.flt" \
TYPE=FLOATGRID \
ELEV_UNITS=METERS \
POLYGON_CROP_FILE="D:\{Input}\AOI\%FNAME_WO_EXT%.shp" \
POLYGON_CROP_BBOX_ONLY=NO \
POLYGON_CROP_USE_ALL=YES \
SPATIAL_RES=0.5,0.5 \
FORCE_SQUARE_PIXELS=YES
UNLOAD_ALL
DIR_LOOP_END -
i relly like this site
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