Grid export tiles geometry not matching

I'm trying to script a grid export of two different datasets. Dataset 1 is a state area. Dataset 2 are county parcel files. I'm trying to load dataset 1, preform a grid export based on the layers extents, and turn that layer off. Then load the directory that holds dataset 2, and grid those out using the previous export bounds, so all the tiles will be exactly the same. Here's where I'm at as of now:
When I do this from the user interface I simply specify the tiles, and draw a bounding box over the first dataset, turn that one off, load the second, tick the tile radio button, and "reset to last export bounds" and everything works as it should.
Can anyone see where I'm going wrong here?
Thanks
Everything loads fine and dataset 1 exports as it should, however, dataset 2 doesn't start with it's first tile, or the tile size where it should and they're not even close to matching.GLOBAL_MAPPER_SCRIPT VERSION=1.00DEFINE_VAR NAME="state" VALUE="MN"DEFINE_VAR NAME="state_background" VALUE="C:\Workspace\Data_State\MN\ERASE\MN_ERASE.shp"DEFINE_PROJ FILENAME="C:\Workspace\Data_State\MN\nm_projection.prj"
SET_LOG_FILE FILENAME="C:\Workspace\Data_State\%state%\ERASE\grid_Export_Logfile.log"
IMPORT FILENAME="%state_background%" TYPE=SHAPEFILE
EXPORT_VECTOR FILENAME="C:\Workspace\Data_State\MN\ERASE\MN_ERASE_INPUTS\er_MN.shp" TYPE=SHAPEFILE SHAPE_TYPE=AREAS GEN_PRJ_FILE=YES GRID_TYPE_ROWS_COLS="8,10" GRID_NAMING=SEPARATE GRID_NAMING_COLS="NUM,1," GRID_NAMING_ROWS="ALPHA,A," LAT_LON_BOUNDS="-97.23919600,43.49936100,-89.4833850,49.38435800"
SET_LAYER_OPTIONS FILENAME="%state_background%" HIDDEN=YES
IMPORT_DIR_TREE DIRECTORY="C:\Workspace\Data_State\%state%\ERASE\COUNTIES" FILENAME_MASKS="*.SHP" RECURSE_DIR=NO
EXPORT_VECTOR FILENAME="C:\Workspace\Data_State\%state%\ERASE\%state%_ERASE_INPUTS\MN.shp" TYPE=SHAPEFILE SHAPE_TYPE=AREAS GEN_PRJ_FILE=YES GRID_TYPE_ROWS_COLS="8,10" GRID_NAMING=SEPARATE GRID_NAMING_COLS="NUM,1," GRID_NAMING_ROWS="ALPHA,A," LAYER_BOUNDS="%state_background%"
UNLOAD_ALL
When I do this from the user interface I simply specify the tiles, and draw a bounding box over the first dataset, turn that one off, load the second, tick the tile radio button, and "reset to last export bounds" and everything works as it should.
Can anyone see where I'm going wrong here?
Thanks
Tagged:
Best Answer
-
bmg_bob Global Mapper Programmer Posts: 2,218
Currently, Global Mapper makes sure that the specified bounds intersect the full bounds of the loaded data, then uses the intersection as the bounds for creating the grid. In the case of your county data set, the loaded data bounds (the county data set) are much smaller than the specified bounds (i.e., the state bounds), so the resulting grid does not match the state grid.
I added a parameter, USE_EXACT_BOUNDS, so that you can customize this behavior. When you specify USE_EXACT_BOUNDS=YES, Global Mapper will use the bounds specified on the command instead of performing the intersection. Add this parameter to the export of your county data set, and it should make the state and county grids match up.
This parameter is implemented in the latest daily build of Global Mapper. Simply download the appropriate installer and run it to install the latest build.
Answers
I tried that too with the same results. I have found a back way around where I assigned a unique value to dataset 1 and DIDN'T turn that layer off when dataset 2 was loaded. Then dataset 2 loads and exports to a temp folder. Then I did a directory loop on the temp folder and deleted the features with the unique value, and exported them, while maintaining their name, to the final folder for my other script.
It's not very neat, but for now, it works
Could you elaborate a little more about what you mean by, "dataset 2 doesn't start with it's first tile, or the tile size where it should"?
What version of Global Mapper are you using?
Can you post a zip archive containing a copy of your script that produces the incorrect output (before you implemented the workaround) and your data? If you prefer, you can send it to geohelp@bluemarblegeo.com, and refer to this forum thread.
I'm using GMv. 17
Here is the script I just tested again that gave faulty results:
And these are the results
those are both named with the same column and row name. When I add:To the end of the script the results are exactly as they should be:
I have attached the script that creates the faulty results.Thanks