Tiling images into 256x256 tiles has gaps

earthstarearthstar Global Mapper UserPosts: 4
edited March 2013 in GM Script Language
I have a requirement to tile a few thousand 1x1 degree GeoTIFF images into 256x256 pixel tiles that need to be butt-joined (no overlap). I have made Global Mapper scripts to process them. In the script I window in on exact 1x1 deg AOIs using "GLOBAL_BOUNDS=" and I have turned on the Maintain Export Bounds Instead of Sample Spacing in the GUI to force export of the exact 1x1 degree areas and resample the resolution as needed. For the most part it turns out OK except that there is a 1-pixel gap or overlap between the groups of tiles for each of the original 1x1 degree areas. (The tiles inside each 1x1 degree group butt join perfectly with no gaps or overlap.) My output format is JPEG with World files. I'm wondering if this is just a rounding error in the World files? Any ideas appreciated. I can provide a test sample and script if needed. A sample line from a script is below:

UNLOAD_ALL
IMPORT FILENAME=C:\Test_1x1_tiles\N30-E074.tif
EXPORT_RASTER FILENAME=I:\15m_256_tiles\N30-E074.jpg TYPE=JPEG SPATIAL_RES=0.0001388,0.0001388 FORCE_SQUARE_PIXELS=YES GLOBAL_BOUNDS=74,30,75,31 GEN_WORLD_FILE=YES GRID_TYPE_PIXEL_SIZE=256,256 QUALITY=75

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited March 2013
    Which version of Global Mapper are you using? Do you have the data loaded that goes all the way to the tile edge prior to doing the export? If you check the metadata for the images on the edge do they actually go to the edge and have a pixel of background data?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/products/global-mapper.php
  • earthstarearthstar Global Mapper User Posts: 4
    edited March 2013
    Mike - I am using 14.1.3. My input images are actually slightly more
    than 1x1 degree, so I know there is data right up to (and beyond)
    the 1 degree mark. (I added 10 pixels of overlap when I made the 1x1
    degree GeoTIFF tiles.) Because of this, in the script I am windowing in
    on exact 1x1 degree increments for the export.

    Which version of Global Mapper are you using? Do you have the data loaded that goes all the way to the tile edge prior to doing the export? If you check the metadata for the images on the edge do they actually go to the edge and have a pixel of background data?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/products/global-mapper.php
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited March 2013
    Is your export projection datum the same as the input data datum? If there was a datum shift that could do it. If that's not it, do you get the same issue if you export clamped to those exact bounds from the user interface? I'm just wondering if this is a script-specific issue.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/products/global-mapper.php
  • earthstarearthstar Global Mapper User Posts: 4
    edited March 2013
    Mike - There is no projection change. You are right though about the GUI
    vs script - I do not get this issue if I manually run each file through the
    GUI with the same parameters. The World files generated by GUI vs script
    are slightly different. I can send you test data, etc. if you need it. Or if there
    is a way to do 1000's of files through the GUI let me know.

    Is your export projection datum the same as the input data datum? If there was a datum shift that could do it. If that's not it, do you get the same issue if you export clamped to those exact bounds from the user interface? I'm just wondering if this is a script-specific issue.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/products/global-mapper.php
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited March 2013
    Yes can you send me a test file and your script so I can try it? There is likely just something with the maintain export bounds over sample spacing setting or something like that.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/products/global-mapper.php
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited March 2013
    Ah I see. What you need to do is add GRID_KEEP_CELL_SIZE=YES to your EXPORT_RASTER script command as that specifies whether the bounds should be maintained over the sample spacing for scripting rather than the setting in the user interface.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/products/global-mapper.php
  • earthstarearthstar Global Mapper User Posts: 4
    edited March 2013
    Mike - Adding GRID_KEEP_CELL_SIZE=YES worked perfectly. Thanks for your usual outstanding tech support!
Sign In or Register to comment.