Trouble running a script inside global mapper...

parrontto3parrontto3 Global Mapper UserPosts: 11
edited November 2010 in Technical Support
& I'm sure it's something I'm missing...

I've got my workspace loaded.. and I'm trying to run a script that does nothing more than export_raster & some variables are declared... I won't post them all because it appears to fail before it does anything but read 'EXPORT_RASTER'...

When I run the script, I don't declare an import filename because I want it to use the currently loaded workspace (which is two dnc charts). What I get is "ERROR: Data must be loaded for EXPORT_RASTER command" and then it shows a script processing complete (but no data)... Can't I run the script against an already loaded workspace? I'm using GlobalMapper 11 by the way...

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2010
    If you are using the File->Run Script menu command, make sure to check the box to run the script in the context of the current map view.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • parrontto3parrontto3 Global Mapper User Posts: 11
    edited November 2010
    If you are using the File->Run Script menu command, make sure to check the box to run the script in the context of the current map view.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com


    Well... I tried that... it ignores my settings in the export statement & uses the default settings for the export (that you come across when you try to export manually).

    My Export Statement looks like this (I know I need the \ for linewrap when actually running it, I just retyped it here):

    EXPORT_RASTER FILENAME="C:\filename" TYPE=KML KML_RASTER_FORMAT=PNG KML_MIN_LOD_PIXELS=64 KML_SUPER_OVERLAY=YES SPATIAL_RES=0.000455993383422734,0.000455993383422734 LAT_LON_BOUNDS=-54,41,-51,46

    Which are the settings I used when manually exporting... I've got a lot of ground to cover so I'm trying to set up a script to make this happen via a batch file so I can work on other things while it's processing.. but I can't even get it to work on one export <chuckle>

    While I'm at it.. can I ask how you would get a workspace to load via a script? Importing doesn't seem to be liking the .gmw extension...
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2010
    Which settings specifically aren't being taken from your EXPORT_RATSER command? It looks ok to me. Does the log on the Run Script dialog show any kinds of error or warnings?

    Use the EMBED_SCRIPT command to load a workspace from a script as a workspace file is a script file (just with a different extension).

    Also, what version of Global Mapper are you using?

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • parrontto3parrontto3 Global Mapper User Posts: 11
    edited November 2010
    Global Mapper 11.... Well.. the LAT_LON_BOUNDS... Instead of ending up with a small square out of the entire chart that's been loaded, I end up w/the entire chart in a KMZ.. Maybe LAT_LON_BOUNDS isn't what I should be using... When I do this manually, I select the LAT/LON on the export bounds tab
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2010
    Can you post your actual .gms file so that I can check it and make sure it is correct? Or you can email it to support@globalmapper.com if you want.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • parrontto3parrontto3 Global Mapper User Posts: 11
    edited November 2010
    OK.. but there's really nothing to it... I just added the embed_script line as you mentioned, but commented it out for now... gotta fix one thing at a time...

    GLOBAL_MAPPER_SCRIPT VERSION=1.00

    SET_LOG_FILE FILENAME="C:\DNCFiles\ScriptLog.txt"

    //EMBED_SCRIPT FILENAME="C:\DNCFiles\DNC1817.gmw"

    //LAT_LON_BOUNDS=W,S,E,N
    EXPORT_RASTER FILENAME="C:\Documents and Settings\cak32\My Documents\DNC Files\GlobalMapperOutput\DNC1817j2.kmz" \
    TYPE=KML KML_RASTER_FORMAT=PNG \
    KML_MIN_LOD_PIXELS=64 \
    KML_SUPER_OVERLAY=YES \
    SPATIAL_RES=0.000455993383422734,0.000455993383422734 \
    LAT_LON_BOUNDS=-54,41,-51,46
  • parrontto3parrontto3 Global Mapper User Posts: 11
    edited November 2010
    I don't know why the second # in the spatial_res keeps putting a space in between the 22 & 734... it's not like that in the script... I've backspaced & retyped the # several times in the script itself & it's not showing any space in there...
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2010
    I think you want to add INC_VECTOR_DATA=YES to your EXPORT_RASTER command to make sure the vector data is included (it will be included by default thought if only vector data is loaded). Also you have a weird '734' with a space in front of it before the LAT_LON_BOUNDS parameter, try changing your script to the following (note quotes around some parameters just in case):

    GLOBAL_MAPPER_SCRIPT VERSION=1.00

    SET_LOG_FILE FILENAME="C:\DNCFiles\ScriptLog.txt"

    //EMBED_SCRIPT FILENAME="C:\DNCFiles\DNC1817.gmw"

    //LAT_LON_BOUNDS=W,S,E,N
    EXPORT_RASTER FILENAME="C:\Documents and Settings\cak32\My Documents\DNC Files\GlobalMapperOutput\DNC1817j2.kmz" \
    TYPE=KML KML_RASTER_FORMAT=PNG \
    KML_MIN_LOD_PIXELS=64 \
    KML_SUPER_OVERLAY=YES \
    SPATIAL_RES="0.000455993383422734,0.000455993383422" \
    LAT_LON_BOUNDS="-54,41,-51,46"

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2010
    Hmmm looks like a space got added for me too. If it's not in the script it should be fine. If you move the LAT_LON_BOUNDS parameter earlier does it show up? What does your log file contain when you are done?

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • parrontto3parrontto3 Global Mapper User Posts: 11
    edited November 2010
    Hmmmmm it seems to have worked this time... the log file doesn't show much of anything... see next two lines:

    Exporting raster data to file C:\Documents and Settings\cak32\My Documents\DNC Files\GlobalMapperOutput\DNC1817j2.kmz
    Script processing COMPLETED.

    Which was all it ever shows... (except when I wasn't checking the 'Run script in the context of the Main View...' then it showed the error I first posted back in post #1)

    So... given that this seem to be working.. I have one more question for you..ok two. When I created this manually, I first used File\ Export Web Formats... and it gives me the same export window as the Export Raster & Elevation Data one... but yet when it's done exporting, it gives me a smaller .kmz file (902kb) than the Export Raster & Elevation Data selection does (1,419kb)? Used the exact same parameters as in my script... 1) Why? And 2) Is there an option to 'export web format' within the scripts? It wasn't obvious to me...
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2010
    There is not an option to export web formats like Google Maps or Bing Maps from a script. You would have to use the SDK to automate that.

    What options are you choosing for the KMZ raster export from the user interface? For example are you checking the option to auto-grid the export? This would correspond to the KML_SUPER_OVERLAY option in the script. This could make a difference in the size of the resulting KMZ file as that would add extra layers to the output.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • parrontto3parrontto3 Global Mapper User Posts: 11
    edited November 2010
    Yes.. that option is selected in the user interface when I run it from there....(which is why I set it to YES in the script..).. I actually opened each of the differing KMZ files & looked at one of the files within (same file from each KMZ) and the actual file size is different.. one is 72kb other is 48.. yet they display the same data... Maybe I'm worrying too much.. but I've got a lot of these to convert to be displayed on GoogleEarth..
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2010
    Can you provide me two of the KMZ files that you have generated so that I can compare them and see what is different?

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • parrontto3parrontto3 Global Mapper User Posts: 11
    edited November 2010
    <sigh> actually I can't... info is not avail to general public...(that sounds weird). but thanks for all your help... your answers have saved me TONS of manual work... it's just the png files that are different sizes.. the .kml is the same size in both exports
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2010
    I'm wondering if maybe they are being generated as 24-bit RGB PNG files in one case and 8-bit palette PNG files in the other. That would be my best guess.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • parrontto3parrontto3 Global Mapper User Posts: 11
    edited November 2010
    Well.. now that's a thought... Because the difference is I used the webformat export to kml/kmz (and that's the smaller of the two) when I created the one manually... the larger was created via the script using export_raster -- hmmmm. When I finish loading the next workspace I'll look at the options & see if that's available or what it might be defaulting to
Sign In or Register to comment.