Global Mapper v25.0

Crop file import to selected area

veddycent
veddycent Global Mapper User
Hi all,

I haven't been able to find a question relating to this so here goes.

I have 1,000,000+ aerial image files but I only need a few of them. I would have to go through each one and see if they are within a shape file area.

Is it possible to load all the files into global mapper, have global mapper see if they are within the selected area, only load them if they are and discard the ones that are not?

Any help would be much appreciated!
Tagged:

Answers

  • kbellis
    kbellis Global Mapper User Trusted User
    You need a tile index; see example

    Talk with your image provider for the index shape files.
  • veddycent
    veddycent Global Mapper User
    Thanks for the reply kbellis. That's a neat tool, I imagine that will come in handy one day. Unfortunately its still a long and manual processes.

    I ended up writing a script that did the job (attached below). 
    Instructions on how to use the script are in the actual script.

    Feel free to use/edit/distribute the script.

    Thanks
  • kbellis
    kbellis Global Mapper User Trusted User
    Sorry, I guess I totally misunderstood what you were asking. I thought that you were trying to find (spatially) what tile went in a specific location. And then you wanted to crop that raster once you knew which one to use. Having a master tile index would at least allow you to identify the tile name, even if you didn't want to make the index interactive using the CALC_ATTR procedure outlined in that little clip I made for my friend.

    I started to take a look at your script, but only got warnings.



    Are you running the script outside of Global Mapper from the command line?

  • veddycent
    veddycent Global Mapper User
    Do you have a layer opened in global mapper? The script uses that layer to get the the area boundary.

    What version of global mapper are you using? I have v19.

  • kbellis
    kbellis Global Mapper User Trusted User
    No, didn't have any data loaded. I'm running v19 and v20 beta.

    I noticed in your screen capture that the instructions appeared at the top of the script; however, the script that I downloaded didn't contain those notes.

    Here is what that downloaded script looked like.:


  • veddycent
    veddycent Global Mapper User
    Ahh... that explains the message it displays when I tried to reattached the script.  :s
    I've attached it again with the instructions in the script.
  • kbellis
    kbellis Global Mapper User Trusted User
    Well that made a difference. Kind of like opening a combination lock using every possible combination through exhaustion and persistence.

    I noticed that the import didn't address the alpha channel, or more accurately the 4th band channel. Perhaps your images are all RGB without the so-called color infrared (CIR), or near infrared.

    If you add this to your import line, 4-band imagery will be properly imported.
    IGNORE_ALPHA="YES"


    The second time I ran the script, all the while still in the initial workspace and after having deleted the loaded ortho layers, and after having added the bits about
    IGNORE_ALPHA="YES"
    I got these errors:


  • veddycent
    veddycent Global Mapper User
    "Kind of like opening a combination lock using every possible combination through exhaustion and persistence."
    I once forgot a combination on a bike lock and this is exactly what I had to do...  :#

    That's an odd error... I tested it here and couldn't replicate it. Maybe a restart of Global Mapper???

  • kbellis
    kbellis Global Mapper User Trusted User
    It also took way less time to find the same dozen or so tiles the second time around. This made me think the two observations; considerably faster loading and the error notices were possibly related to how Global Mapper might temporarily store items in memory.

    Your script has me thinking about taking it a step further by automating the creation of a master index with linkages to the individual images. But I'm not sure if Global Mapper will allow creation of shape files from variables, given recent conversations with bmg_bob.

    Probably the easiest thing would be to ask the image provider for the index shapefiles, but still your script had me thinking that automating the creation of an index for all images might possibly be done.
  • kbellis
    kbellis Global Mapper User Trusted User
    edited August 2018
    Hmm, looks interesting.

    One thought regarding that thread and the script therein,and in particular to what you said at the top of this thread;
    I have 1,000,000+ aerial image files
    Do you happen to know if all of your images share the same projection; e.g., all within and on UTM Zone 30? The reason for asking has to do with: 1) shared or dissimilar central meridians; and 2), how "bounds" are determined by Global Mapper in so far as they apply to non-orthogonal areas. The result could be an issue crossing zone boundaries.



    This map showing that not all UTM zone are 6° wide, is Copyright V. Kelly Bellis. The copyright notice was originally stored in the EXIT data, but this forum's software has apparently stripped that information from the image, thus the need for this notice. User's sharing copyright protected materials should be made aware of this unfortunate policy.

  • veddycent
    veddycent Global Mapper User
    in my case they all share the same projection, its 25cm of the whole of the UK so uses the British Grid/OSGB projection

    I imagine that multiple projections most likely will not work with the script. I always like to work with the same projection for all the data I'm processing so I probably will not run into this issue.

    I'm not sure where I got the 1,000,000+ files I mentioned  :| but I do know that it's about 14TB of data.

    The script that I originally wrote solved my needs so I don't need to develop it further... but by all means use it as a basis to adapt/develop for any of your uses.