LAT_LON_BOUNDS not working in EXPORT_RASTER command
kartoone76
Global Mapper UserTrusted User
Here is a snippet of a GMS script that used to work correctly, but now gives me a "No data exists in the export bounds for EXPORT_RASTER command".
EXPORT_RASTER FILENAME="7dd1c7dd7cbfcdac7fd0d97913c22a75ea5c5d00.jpg" QUALITY=95 SAVE_SCALE_AND_LEGEND=YES INC_VECTOR_DATA=YES TYPE=JPEG SPATIAL_RES=3.7698534844648,3.7698534844648 LAT_LON_BOUNDS="-86.86426,33.38086,-86.70204,33.49545"
I have loaded a Mercator Projection which is expecting bounds in spherical units. Previously, I was able to specify the LAT_LON_BOUNDS and it would export correctly. Now, it is giving me a "no data exists" error, presumable because it is interpreting -86.86426,33.38086, etc... as spherical units instead of lat/lon degrees.
I've attached the complete script ... let me know if you need the datasets as well or if this is enough for you to recreate the problem. I am using Global Mapper 12.01, 64 bit, Build time Jan 20 2011
t2.gms
EXPORT_RASTER FILENAME="7dd1c7dd7cbfcdac7fd0d97913c22a75ea5c5d00.jpg" QUALITY=95 SAVE_SCALE_AND_LEGEND=YES INC_VECTOR_DATA=YES TYPE=JPEG SPATIAL_RES=3.7698534844648,3.7698534844648 LAT_LON_BOUNDS="-86.86426,33.38086,-86.70204,33.49545"
I have loaded a Mercator Projection which is expecting bounds in spherical units. Previously, I was able to specify the LAT_LON_BOUNDS and it would export correctly. Now, it is giving me a "no data exists" error, presumable because it is interpreting -86.86426,33.38086, etc... as spherical units instead of lat/lon degrees.
I've attached the complete script ... let me know if you need the datasets as well or if this is enough for you to recreate the problem. I am using Global Mapper 12.01, 64 bit, Build time Jan 20 2011
t2.gms
Comments
-
At first glance I'm not seeing anything wrong. If you run this in Global Mapper with the File->Run Script command what are the bounds of the data that end up loaded in the main view? What do the contents of your mercator.prj file look like? It could be a problem in that file preventing the specified lat/lon bounds from being converted to the export projection.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
When I try running this via File -> Run Script, the bounds are as follows:
UPPER LEFT X=-43253.052
UPPER LEFT Y=110579.965
LOWER RIGHT X=154572.543
LOWER RIGHT Y=-0.000
WEST LONGITUDE=0° 23' 18.7756" W
NORTH LATITUDE=0° 59' 35.9051" N
EAST LONGITUDE=1° 23' 18.7756" E
SOUTH LATITUDE=0° 00' 0.0000" S
PIXEL SIZE X=103.249 meters / pixel
PIXEL SIZE Y=103.249 meters / pixel
SCALE=1:390200
ENCLOSED AREA=8445.5 sq mi
VIEW PIXEL SIZE=1916 x 1071
The complete output in the Run Script dialog is as follows:
Importing file d:\data\7dd1c7dd7cbfcdac7fd0d97913c22a75ea5c5d00.gmg...
Generating contours from loaded elevation data...
Loading new global projection...
Importing file d:\data\7dd1c7dd7cbfcdac7fd0d97913c22a75ea5c5d00-lines.shp...
Importing file d:\\data\\7dd1c7dd7cbfcdac7fd0d97913c22a75ea5c5d00-areas.shp...
Importing file d:\data\7dd1c7dd7cbfcdac7fd0d97913c22a75ea5c5d00-pts.shp...
Importing file d:\\data\\7dd1c7dd7cbfcdac7fd0d97913c22a75ea5c5d00.kml...
Exporting raster data to file c:\topos\7dd1c7dd7cbfcdac7fd0d97913c22a75ea5c5d00.jpg...
ERROR: No data exists in the export bounds for EXPORT_RASTER command.
ERROR: No raster data found for EXPORT_RASTER command.
Script processing COMPLETED.
In case it helps, I have attached the Mercator projection file. This file was working correctly before without changes. Is there a way using the scripting language to switch the global projection to one of the built-in projections?
mercator.prj -
Based on the reported bounds your data wouldn't intersect the LAT_LON_BOUNDS that you provided. If you run the script and then run the cursor over the coordinates, is the data correctly placed where you expect in terms of lat/lon?
You can use the LOAD_PROJECTION script command to change the current global/export/view projection.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
OK, I think we are getting closer to the problem, but it is not a problem with EXPORT_RASTER but rather the LOAD_PROJECTION command which I was already using. I still think this is a bug because I haven't made any changes on my end to the system that I am using to generate the Global Mapper Script. All I did was update to the latest build 12.01 and all of a sudden my scripts stopped working.
Here is how to recreate the problem.
1. This one works (note the commented out third line)
The zip file is a GMG elevation file exported using a geographic projection.
UNLOAD_ALL
IMPORT FILENAME="d:\data\elev.zip" SHADER_NAME="Atlas Shader"
SET_VERT_DISP_OPTS ENABLE_HILL_SHADING=YES
// LOAD_PROJECTION FILENAME="d:\data\prj\mercator2.prj"
EXPORT_RASTER FILENAME="d:\data\elev.jpg" QUALITY=95 SAVE_SCALE_AND_LEGEND=YES INC_VECTOR_DATA=YES TYPE=JPEG SPATIAL_RES_METERS=4.6597800000001,4.6597800000001 LAT_LON_BOUNDS="-86.82564,33.39189,-86.69346,33.53882"
2. This one doesn't work: (i.e., "no data for export raster command")
UNLOAD_ALL
IMPORT FILENAME="d:\data\elev.zip" SHADER_NAME="Atlas Shader"
SET_VERT_DISP_OPTS ENABLE_HILL_SHADING=YES
LOAD_PROJECTION FILENAME="d:\data\prj\mercator2.prj"
EXPORT_RASTER FILENAME="d:\data\elev.jpg" QUALITY=95 SAVE_SCALE_AND_LEGEND=YES INC_VECTOR_DATA=YES TYPE=JPEG SPATIAL_RES_METERS=4.6597800000001,4.6597800000001 LAT_LON_BOUNDS="-86.82564,33.39189,-86.69346,33.53882"
3. Interestingly, though, if I manually load the projection file from within Global Mapper before doing the export, the export works fine. I have attached all the necessary files to recreate the problem. (See working.gms and nonworking.gms which both reference elev.zip) I have attached the mercator projection file which was created by clicking "Save as File" from the Configure -> Projection menu -
Very strange I just ran you 'nonworking.gms' and it worked perfectly for me. I checked the JPG and it is fine. I wonder if you have a strange build or something. Can you try getting the latest build and see if that helps? I have placed a new build at http://www.globalmapper.com/global_mapper12.zip with the latest changes 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 -
I downloaded and extracted the latest build (b021711) into my Global Mapper 64 bit folder and tried again. Still not working. Here are two screenshots showing the problem... notice the crazy scale on the first screenshot. The second screenshot is taken after I clicked OK, opened the control center, and right-clicked on the elev.gmg layer and selected "Zoom to layer". Note that the scale is correct in the second screenshot!
screenshot1.jpg
screenshot2.jpg
Do you think it might be something with my registry settings? I tried uninstalling and reinstalling Global Mapper with no luck. -
I am baffled, I simply cannot get it to fail on my machine. How are you running the script? I have tried both using File->Run Script and loading the script as a workspace and it works perfectly in all cases, both in Debug and in the Release 64-bit build. Although I can't think of any settings that would mess this up, you could go to the General tab of the Configuration dialog and click the button to reset the defaults and see if that does anything.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
That did the trick. I clicked the button to reset the defaults and then dragged the .GMS file into Global Mapper. It worked perfectly! I will keep an eye on the settings as I change them to find out which setting breaks the script.
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