Global Mapper v25.0

Autoposition Surfer Grid (.grd) files on a GeoTIFF...

dp_man2
dp_man2 Global Mapper User
edited January 2014 in Vector Data
I would like to know how to do the following in Global mapper 15;

a. I have about 2000 (about 330 x 6 named by ID and category) rectangle shaped Surfer 11 .grd (Gridfiles), that needs to be auto-positioned correctly in sets of 6 (over each other) on top of a GeoTIFF. The GeoTIFF is 0,25 m resolution per pixel, WGS84, and the .grd files have 3 columns; A and B is x and y in meter, in relation to 0, 0 of the grid file, and C is elevation I think. It is metal detector data. The grid files have no coordinate system.

b. The GeoTIFF is also in meter, and I have a comma separated file with the "columns" [.grd file ID, start Lat, start long, end lat, end long.] Each grid file needs to be position with 0, 0 starting at start lat, start long from .csv file for that grid file ID. The scale of a meter in the grid file also needs to be correct in relation to the GeoTIFF meter. Then the end point furthest away from the 0, 0 position in the grid file rectangle, needs to be positioned at, or as close as possible to end lat, end long.

Questions;

Is this possible to automate in Global mapper 15 ? In that case, how ? Or could I use some Windows macro software to make Global mapper process these steps ? Please advice me on the functions I need to use.

Thank you

Comments

  • dp_man2
    dp_man2 Global Mapper User
    edited November 2013
    I can have the start lat, long, end lat, long placed anywhere for import and use, the grid files could be named with these coordinates, or I could have them placed in any file format. Or maybe I can metatag the grid files ? Any info that Global mapper can use, I can do, but I need to know the work method and what functions to use in Global mapper. Thanks for your help.
  • dp_man2
    dp_man2 Global Mapper User
    edited November 2013
    I also would like to know if it is possible to crop surfer grid files (.grd) in Global mapper 15, chopping off and deleting a section to the left, right, top or bottom ?
  • global_mapper
    global_mapper Administrator
    edited November 2013
    If you can write an external macro or batch file of some kind to read through your CSV file and figure out the corner coordinates, you could then provide those with the IMPORT command in the script (see Global Mapper Scripting Reference) to rectify each grid file on import to place it. You would use the GCP parameter on the IMPORT command to provide each control point (just 2 corners would be enough).

    You can also get an example of this by loading one GRD file then right-clicking on it in the Control Center and selecting to Reposition it. You can then provide 2 control points and save a workspace. The workspace (.gmw) is a script file, so just open in a text editor (like Notepad) to see how the IMPORT command is set with the control points.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • dp_man2
    dp_man2 Global Mapper User
    edited November 2013
    Fantastic ! So the two control point would be the 0, 0 position and the point furthest away from 0 , 0, but in GPS coordinates ? The problem is.. the grid file is an array walked with the metal detector, and the GPS unit on the detector was placed on the operator guy, not the guys walking the frame. So the meter X and Y area size of the grid file, will not correspond precisely with the start and end GPS positions. This is why I need the correct scale to be synced between the grid files and the GeoTIFF, as a priority over the GPS position control points (the second position) matching the grid.

    Is this possible to do in Global mapper somehow ? fixing the scale as priority over the control points ?
    If you can write an external macro or batch file of some kind to read through your CSV file and figure out the corner coordinates, you could then provide those with the IMPORT command in the script (see Global Mapper Scripting Reference) to rectify each grid file on import to place it. You would use the GCP parameter on the IMPORT command to provide each control point (just 2 corners would be enough).

    You can also get an example of this by loading one GRD file then right-clicking on it in the Control Center and selecting to Reposition it. You can then provide 2 control points and save a workspace. The workspace (.gmw) is a script file, so just open in a text editor (like Notepad) to see how the IMPORT command is set with the control points.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • global_mapper
    global_mapper Administrator
    edited November 2013
    What actual position information can you easily get for the grid files? If you know the coordinate of some pixel (grid value) in the file and the spacing in between cells (i.e. scale) you could add a control point at that known grid location with the XY pixel location and the XY ground location, then add another one 1 pixel away in X and Y and offset by the known distance between control points. That would be good enough for a rectification then assuming everything is linear.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • dp_man2
    dp_man2 Global Mapper User
    edited November 2013
    The metaldetector datalogger creates a textfile comma separated with 6 different channels of data, plus X and Y real world WGS84 GPS coordinates for each line in the txt file (set of 6 parameters). The surfer script from the metal detector provider, then process this textfile and creates 6 different surfer grid files and 12 graphs from these grid files (6 in 2D and 6 in 3D). The grid files doesn't retain any GPS coordinates, only meter distance from the 0, 0 position of the grid file, in X and Y.

    The first line in the original datalogger txt file, contain the starting point GPS coordinate, and the last line contain the ending point coordinate. But I can't have Global mapper to distort the grid file, so that it will press it to fit between the start and the end GPS control points. Global mapper must place the grid file exactly with the 0, 0 at the start GPS, and then put the end position as close as possible to the end GPS coordinate, without distorting the grid size. Or else the measurements will not be correct within the grid.

    How do I do this ?

    Regarding the import function: It could be possible for me to create about 2000 import commands (in a text manipulator software), one for each gridfile, and then run them in some script mode in global mapper ?
    What actual position information can you easily get for the grid files? If you know the coordinate of some pixel (grid value) in the file and the spacing in between cells (i.e. scale) you could add a control point at that known grid location with the XY pixel location and the XY ground location, then add another one 1 pixel away in X and Y and offset by the known distance between control points. That would be good enough for a rectification then assuming everything is linear.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • dp_man2
    dp_man2 Global Mapper User
    edited November 2013
    The detector array have been collected in the field in many different directions and bearings and sizes, so there are no way to position an array correctly without knowing the start and end GPS coordinate. The grid file contain exact measurements in meters, X and Y, and reading the last row in the grid file (after converting it to data) will give me the size of the individual grid in meters, X and Y. The GPS had an accuracy of 2 to 2, 5 meters, so the start and end point as recorded by the GPS, will probably not have a distance between each other that correspond to the grid file X and Y.
  • global_mapper
    global_mapper Administrator
    edited November 2013
    Can you provide a sample of that CSV file? It might be possible to step back to that and actually load that directly in Global Mapper as properly positioned point data with some numeric value to grid in one of the attributes. You could then treat that attribute as "elevation" for the layer and grid it. The grid would automatically be positioned properly in GM.

    You could even load all of the point files at once, then grid the entire collection into one grid rather than having 1000 separate grid files.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • dp_man2
    dp_man2 Global Mapper User
    edited November 2013
    Do you mean the datalogger txt files or the coordinate file I will create ? The datalogger file cannot be used I think as it needs to be processed by the Lorenz metaldetector script in surfer first to create 6 different grid files. But I have attached a sample of the datalogger file.

    If it is possible to write a script command or several that import grid files, place them correctly on 0, 0 Gps positions with bearings in relation to a second gps position, and then write the name of the grid file on the grid surface with low opacity, then I would be soo greatful. Please advice me on commands to use.
  • global_mapper
    global_mapper Administrator
    edited November 2013
    The first line in that file looks like the following:

    0 0 8361427 8321135 2086785 8436700 8415080 00 4430.7486 N 06417.4951 W

    It looks like the degree latitude and longitude are in fields at the end. Is one of the columns before that the data that Surfer is gridding? You can set up a custom IMPORT_ASCII command to pull in the lat/lon from those fields and treat one of the others as elevation, then grid that. If you could go right from that you could skip all of the complexity of trying to figure out how to build custom IMPORT commands with control points for the corners to position it.

    If however there isn't a way to get the grid value you want from those other columns then you could use the GRD values from Surfer with the IMPORT script command in Global Mapper and the GCP values for 2 known points. If you can add those known points (if you have more than 2 even better) then you could put as many IMPORT commands as you want in the script, but I think you will have a lot more flexibility and less chance of error if you can start right from the raw files that have lat/lon locations in them. I'm just not sure what the other fields are and if it is possible to extract what you need from that.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • dp_man2
    dp_man2 Global Mapper User
    edited November 2013
    What the surfer script from lorenz does it that it ask the user for track length and array width in a dialog. For my use it is always track length (Y), 20 m, and array width 2 m.. then the script calculates the grid file total Y and X somehow, with X being several array widths different for each txt file.
  • dp_man2
    dp_man2 Global Mapper User
    edited November 2013
    The math in the Lorenz script is quite complicated, and the analyst need all six grid files to analyse if metal. I can't go past the surfer script I think. But I'm pretty good at automation so I will do some scripting. But if I set two control points, will GM distort the size of the grid to match the points ? Or can I freeze the 0, 0 start position and set the second control point as "nearest possible without distorting the measurements in the grid file ?

    Also, what script command do I use to print the name of the grid file, or any name, on the surface of the grid ? setting opacity to 40%?
    The first line in that file looks like the following:

    0 0 8361427 8321135 2086785 8436700 8415080 00 4430.7486 N 06417.4951 W

    It looks like the degree latitude and longitude are in fields at the end. Is one of the columns before that the data that Surfer is gridding? You can set up a custom IMPORT_ASCII command to pull in the lat/lon from those fields and treat one of the others as elevation, then grid that. If you could go right from that you could skip all of the complexity of trying to figure out how to build custom IMPORT commands with control points for the corners to position it.

    If however there isn't a way to get the grid value you want from those other columns then you could use the GRD values from Surfer with the IMPORT script command in Global Mapper and the GCP values for 2 known points. If you can add those known points (if you have more than 2 even better) then you could put as many IMPORT commands as you want in the script, but I think you will have a lot more flexibility and less chance of error if you can start right from the raw files that have lat/lon locations in them. I'm just not sure what the other fields are and if it is possible to extract what you need from that.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • global_mapper
    global_mapper Administrator
    edited November 2013
    The control points will be maintained exactly in almost all cases with the data stretched to fit them, so make sure you calculate the control points such that there is no distortion (i.e. same X and Y pixel size if that is what is correct). If you are able to calculate actual ground coordinate values for several points in the grid then if there is any rotation or skewing having 4 or 5 points should be able to handle all of that accurately so long as there are no non-linear effects in whatever ground system you end up using.

    You could use the GENERATE_LAYER_BOUNDS (Global Mapper Scripting Reference) function to quickly generate bounding boxes (or polygons) for each loaded grid layer. The layer filename should automatically be the display label for each created bounding box/polygon. You can set up styling for the bounding box layer on the Area Styles tab of the Options dialog for the layer once you have them all loaded. Also possible via script but if you are just doing once for all might as well just set it layer in the GUI.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • gmt314
    gmt314 Global Mapper User
    edited January 2014
    Hi dp_man2

    I have the Lorenz X6. It has Surfer CD but I can't find the script you mentioned.
    Where I can find that script? Can you send me a copy of it?

    Thank you in advance