Global Mapper v25.0

Import of XY Color Text File

ChuckB
ChuckB Global Mapper UserTrusted User
edited February 2012 in Raster Data
Hi,

It is good to see that a raster image can be exported as an "XY Color Text File". I would like to play with this capability to perform quick experiments with examination of and custom manipulation of imagery at a pixel level, eventually programming it in a more efficient manner if it seems worthwhile.

Is there anyway to get a file back into GM after playing with the RGB values?

GM supports writing out projection and world files; so it looks like that might be intended.

Thanks,
Chuck

PS The exported world files don't seem to get an extension.

Comments

  • global_mapper
    global_mapper Administrator
    edited February 2012
    Chuck,

    You could read the generated file back in as a point file with a separate attribute with the color for each point, but there isn't currently a way to actually color the points based on that without tweaking the attribute value a bit.

    I did go ahead and update the world file generation to make sure a file extension is placed on there, although really you wouldn't need a world file for this one since each point has a full XY coordinate. I have placed a new build at http://www.globalmapper.com/global_mapper13.zip with the latest changes for you to try. Simply download that file and extract the contents into your existing v13.xx installation folder to give it a try. If you are using the 64-bit v13 version there is a new build at http://www.globalmapper.com/global_mapper13_64bit.zip .

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • ChuckB
    ChuckB Global Mapper User Trusted User
    edited February 2012
    Mike,

    Thanks for the (usual) quick reply.

    What I was hoping for was for it to come back in as imagery.

    I guess the thing to do is to quit being lazy and just work directly with something like BIL formatted raster data as you suggested in a thread from last spring.

    Chuck
  • global_mapper
    global_mapper Administrator
    edited February 2012
    Chuck,

    Oh definitely if you are going to be pulling the data back in the XY Color text format is about as inefficient as you can get. Even BIL with no compression if much better and also much easier to work with than a text file since you don't have to parse the data and try to fit it in a grid, it's already there. Or you could use something like JPG, PNG, or BMP which have lots of libraries for working with them, but BIL is the simplest since it's just a flat binary file, it just doesn't support compression or anything like that.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • global_mapper
    global_mapper Administrator
    edited February 2012
    Chuck,

    Oh thought I might mention you could also use the Global Mapper SDK. It will easily load tons of image formats then you can directly access them much easier than any other API. Could probably save yourself a lot of development time using that. See the Developers page at http://www.globalmapper.com for details.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • ChuckB
    ChuckB Global Mapper User Trusted User
    edited February 2012
    Mike,

    I just want to thank you for NOT giving me I asked for!

    The speed difference is well worth the bit of programming effort it took to get my brain working that way again.

    Also, I figure that if you DID support pulling XY Color Text Files in as imagery you would in essence be creating a somewhat odd imagery format, one that would be unfriendly to use for anything but quite small images.

    Thanks,
    Chuck

    PS I also learned that BIL, BIP and BSQ support multiband data. GM seems to work well with that, but one thing that confused me for a bit was that it seems to set the band order by default to be RGB <---> 321 as well as setting a 2 standard deviation linear stretch. The documentation I found on those formats shows Red first. For a while I figured it was the data I was writing out that was the reason for the unexpected look of the images. (I realize there may be good reason for defaults as they are.)
  • global_mapper
    global_mapper Administrator
    edited February 2012
    Chuck,

    I'm glad you were able to get the BIL format to work. You can pretty much write out the bands however you want in BIL, it is completely free-form, you just have to describe the layout in the HDR file. So for multi-band data Global Mapper writes them out in the normal band order, so if you have 8 bands, they are written out 12345671234567... For RGB images it varies on whether the 1st band is red or the 3rd is, or sometimes for multi-band the configuration is like 431 or something else entirely different.

    Thanks,
    M
    ike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • ChuckB
    ChuckB Global Mapper User Trusted User
    edited February 2012
    Mike,

    I agree that GM by default writes the bands into BIL, BIP and BSQ files as you say. Additionally it says by default during export that Band 1 is to be the red channel, Band 2 the green channel and Band 3 the blue channel. (The dialog I am referring to here is titled "Setup Bands for Export".) These defaults are what I would expect from the documentation I found on these file formats.

    What confused me for a bit is that when GM loads a 4-band file of any of these three types it assigns Band 3 (not 1) to the red channel, Band 2 to the green channel, and Band 1 (not 3) to the blue channel. (With 3-band data Band 1 goes to red, Band 2 to green and Band 3 to blue as I would expect.) The dialog I am referring to here is the Band Setup tab of the Raster Options dialog. Additionally GM assigns a linear stretch to 4-band data, but not to 3-band data, leaving the latter at "No Contrast Adjustment".

    In short if one exports just three bands of 4-band NAIP data that data can be reloaded and by default looks just like what was exported. But if all four bands of 4-band NAIP data is exported and then reloaded the default is for red and blue to be switched as well as there being an automatic contrast enhancement.

    This is NOT a big deal and, I keep thinking, may actually be how you want GM to behave. It is easy to change these after the 4-band data is loaded. It just took me a bit to realize what was going on.

    Thanks,
    Chuck
  • global_mapper
    global_mapper Administrator
    edited February 2012
    Chuck,

    Ah yes, that default swapping of bands 1 and 3 is because when support for multi-band BIL files was originally added the most common 4-band data set (Landsat) looked best with a 321 band orientation, so they are swapped by default when loading a multi-band BIL file. Now it is more of a mix as to which is most common, but for backwards-compatibility sake the default for that particular format has been kept as 321.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com