Global Mapper v25.0

Script to JPG file export

mek
mek Global Mapper User
edited April 2009 in Raster Data
Hello, I am new here and my English is bad, excuse me.
I am making script to open a map, change then projection and export to a JPG file, changing de pixel spacing.
My question is the following one. How I can change from script the “pixel spacing”?

Thanks.
:)

pixelspacing.jpg


example:
GLOBAL_MAPPER_SCRIPT VERSION=1.00
UNLOAD_ALL

DEFINE_PROJ PROJ_NAME="PROJ_UTM"
Projection UTM
Datum EUROPEAN_1950_(SPAIN_AND_PORTUGAL)
Zunits NO
Units METERS
Zone 30
Xshift 0.000000
Yshift 0.000000
Parameters
END_DEFINE_PROJ


IMPORT FILENAME="D:\MAPS\o_90_13_10M.jpg" \
TYPE=AUTO PROJ_NAME="PROJ_UTM"


DEFINE_PROJ PROJ_NAME="PROJ_GEO"
Projection GEOGRAPHIC
Datum WGS84
Zunits NO
Units DD
Xshift 0.000000
Yshift 0.000000
Parameters
END_DEFINE_PROJ

LOAD_PROJECTION PROJ_NAME="PROJ_GEO"

EXPORT_RASTER FILENAME="D:\MAPS\o_90_13_10M_1mpix.jpg" \
TYPE=JPEG FORCE_SQUARE_PIXELS=YES GEN_WORLD_FILE=YES GEN_PRJ_FILE=YES

Comments

  • global_mapper
    global_mapper Administrator
    edited April 2009
    Just add a SPATIAL_RES parameter to your EXPORT_RASTER script command specifying the desired sample spacing for the export. Here is the documentation for that parameter:

    SPATIAL_RES - specifies spatial resolution. Defaults to the minimum spatial resolution of all loaded data if not specified. Should be formatted as x_resolution,y_resolution. The units are the units of the current global projection. For example, if UTM was the current global projection and you wanted to export at 30 meter spacing, the parameter/value pair would look like SPATIAL_RES=30.0,30.0.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • mek
    mek Global Mapper User
    edited April 2009
    Thank you, Mike.
    The problem is that mi projection must be in Geographic, the units in Arc Degrees and i need put de "pixel spacing" in Meters.
  • global_mapper
    global_mapper Administrator
    edited April 2009
    You have to specify the pixel spacing in your export projection as you can't resample data in units other than what you are exporting in. What you can do is start the export in the GUI to get an approximate degrees value for a 1m x 1m export using the 'Calculate Spacing in Other Units' button, then use those in your script. Note that there is not a simple conversion factor from meters to degrees as one is a linear unit and the other an angular unit. The conversion will vary from place to place on the earth.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • Matt
    Matt Global Mapper User Trusted User
    edited April 2009
    For what it's worth....this is one that's stumped me on a number of occasions also. Would be nice if GM could automatically convert.