Batch Geotiff/JPG Conversions

kwmishkwmish Global Mapper UserPosts: 4
edited June 2008 in Raster Data
Hi,

I'm trying to figure out the best GM tools to accomplish the following:
- find all the tiff & jpg files that are within a nested directory structure
- For each file, determine it's coordinate system
- Based on it's current coordinate system, set the projection
- save the new image file (one per source image)

I think the best would be to create a perl script (or something like that) to recursively go through the nested directory and find the tif or jpg file. Then call a GM script for the one file.

That brings up some questions.
- is the only way to read the current coordinate system is to export a prj?
- can I pass in parameters to the GM script (ie the source filename).

I guess I could have the wrapper script generate the GM script on the fly as it finds the image file. The biggest question is do I have to create a prj, read it and then load the new projection. If that is the case I think I would have to have two seperate GM scripts created on the fly (one to create the prj) and the second one to load the new projection and save the new file.

Hopefully that's clear! If anyone can give me any suggestions I would really appreciate it.
Thanks,
Kathy

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2008
    I would think that the normal File->Batch Convert/Reproject command would work. Just choose to generate the export file in the native projection of the source file (this is the default).

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • kwmishkwmish Global Mapper User Posts: 4
    edited June 2008
    Hi Mike,

    I need to determine what the source raster file is to determine how I want to reproject the new export file.

    For example: If the source is UTM 8 - NAD27, I want to reproject the raster to a UTM8 - NAD83. If the source is UTM9-NAD27, I want to reproject to raster UTM9-NAD83.

    Is there a way to do that other then the complicated steps I was thinking of?

    Thanks!
    Kathy
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2008
    Kathy,

    Yes, the batch convertor has a datum option allowing you to select an output datum other than the input datum when converting files.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • kwmishkwmish Global Mapper User Posts: 4
    edited June 2008
    Mike,

    The problem is I don't know what output datum I want until I read the datum of the source file. Each output datum for each image will needs to be determined when the source datum is read.

    If I used a batch convertor with the datum option, I would have to set a single output datum.

    In a batch script, can I read the source projection of an image and set the output datum, depending on the source projection?

    Thanks,
    Kathy
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2008
    Kathy,

    The scripting language does not have any kind of logic capabilities for doing something based on something else. I think your best bet would either be what you described earlier (i.e. export out a PRJ file from a script, then read it back in, generate a new script, then run it), or to use the Global Mapper SDK to load your data file, query the projection, then export a new file with the desired projection/datum. See the Developers page at GLOBAL MAPPER for more details on the SDK.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • kwmishkwmish Global Mapper User Posts: 4
    edited June 2008
    Thanks! I just wanted to make sure I wasn't missing anything.
Sign In or Register to comment.