Global Mapper v25.0

Custom Gridding on export

STH
STH Global Mapper UserTrusted User
edited June 2009 in Suggestion Box
Is it possible to load custom gridding from a file? We have a file that contains the grids and would like it to load in GlobalMapper and then export as GeoTiff. Perhaps add the option in "Gridding" something like "Grid Layout from Selected Area/File". Similar to "Export Bounds" and "Crop Selected Area Features(s)"? The Gridding may be described as a text-file or DXF-file? If text-file is the option then it should load the following tags:

"TileName" "NWx" "NWy" "SEx" "SEy"

Is this possible?

Comments

  • global_mapper
    global_mapper Administrator
    edited November 2007
    This is not currently possible with Global Mapper, but is something on our todo list. You could do something like this using the Global Mapper SDK, then you could just read the file yourself and do individual export commands. Or you could write a small application to create a Global Mapper script file that does all of the exports that you need, then run that script file.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • pcook911
    pcook911 Global Mapper User
    edited January 2008
    Mike,

    Why not allow gridding based on a vector (shapefile) in the Global Mapper Workspace?

    For instance right now I am using an arcscript for ArcMap to batch clip an NAIP county aerial based on the grid shapefile included in the NAIP download. It has been running for about 3 hours and it is 30% done. I guess I will leave going tonight. We all now how much faster a process like this would go if I could use Global Mapper instead.

    Paul

    P.S.

    If there someway to accomplish this that I have missed let me know and you could be my hero.
  • global_mapper
    global_mapper Administrator
    edited January 2008
    Paul,

    You can clip an export to one or more selected area features on export, but there is not currently a way to do multiple exports based on multiple selected area features (i.e. one export per area feature). This is something that we are considering for a future release though.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • STH
    STH Global Mapper User Trusted User
    edited April 2008
    I am trying to do this now. I have a done the following:
    GLOBAL_MAPPER_SCRIPT VERSION="1.00" FILENAME="T:\WORKSPACE.GMW"
    UNLOAD_ALL
    DEFINE_PROJ PROJ_NAME="UTM_ZONE32_WGS84"
    Projection     UTM
    Datum          WGS84
    Zunits         NO
    Units          METERS
    Zone           32
    Xshift         0.000000
    Yshift         0.000000
    Parameters
    END_DEFINE_PROJ
    SET_BG_COLOR COLOR=RGB(100,100,100)
    
    IMPORT FILENAME="T:\testfile.tif" \
    	 TYPE="GEOTIFF" LABEL_FIELD="" ANTI_ALIAS="NO" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" \
    	 CONTRAST_MODE="NONE" 
    
    EXPORT_RASTER FILENAME="T:\testfile_export.tif"   \
        TYPE=GEOTIFF LAYER_BOUNDS="T:\testfile.tif"   \
        POLYGON_CROP_USE_ALL="T:\Areas.shp" \
    

    However it does not crop at the Areas within the file Areas.shp.

    I am trying to do something similar to: File - Batch convert/reproject and selecting "Crop to Selected Areas" and "Maintain Full Size When Cropped"
  • global_mapper
    global_mapper Administrator
    edited April 2008
    Your EXPORT_RASTER command should have a POLYGON_CROP_FILE="t:\Areas.shp" parameter as well as a POLYGON_CROP_USE_ALL=YES parameter. As it is not you are not actually specifying a crop file.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • STH
    STH Global Mapper User Trusted User
    edited April 2008
    I could not use this approach because of a black border around 1/2 pixel within the crop-area. So I have to do it by feathering each import file, and crop 2 pixels. So i use the following:

    My final approach was to load all background files and then do this for each file on top of the background-files:
    IMPORT FILENAME="newMosaic.tif" \
    TYPE="GEOTIFF" PROJ_NAME="UTM_ZONE32_WGS84" LABEL_FIELD="" 
    ANTI_ALIAS="NO" AUTO_CONTRAST="NO" \
    CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" CLIP_COLLAR="NONE" 
    TEXTURE_MAP="NO" TRANSLUCENCY="512" \
    FEATHER_BLEND_SIZE="2" FEATHER_BLEND_EDGES="48" 
    FEATHER_BLEND_POLY="FEATHER_POLY"	
    EXPORT_RASTER FILENAME="Q:\mergedMosaikk.tif" \
    TYPE=GEOTIFF OVERWRITE_EXISTING="NO" LAYER_BOUNDS="newMosaikk.tif" \
    

    However this seems to take a lot of time, and I am not sure why. Is it because of the FEATHER_BLEND_SIZE="2" - calculations? Is there a difference if you load/unload one and one file rather than loading all files in the beginning of the script? Is the problem that the files are located on a network drive and GM does not buffer the files on a temp-file locally or in memory/swap file and requires a lot of reading then the network is busy? I see that GM only use around 70-80MB of memory and the swap-file is only 3-400MB.

    UPDATE: When turning off the FEATHER_BLEND completely with the same files it is lightning fast - so I guess the computation of the FEATHER_BLEND_POLY takes all the time. But I guess there is no other way to do my operation faster?
  • global_mapper
    global_mapper Administrator
    edited April 2008
    Whenever you do a polygon-based operation (i.e. crop or feather to polygon), this will tend to significantly slow down your export, particularly if the crop polygon has a lot of vertices, as the point-in-polygon operation can be slow.

    However, one other thing that I notice is that you are not specifying the bounds to export when using the EXPORT_RASTER script command. When you specify a polygon crop file during export the bounds of that polygon will be used as the export bounds, but in the absence of a crop polygon or explicitly specified export bounds, the bounds of all loaded data will be used, which could be the most significant source of your slowdown as you may be exporting a lot more data that you are intending to.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • STH
    STH Global Mapper User Trusted User
    edited April 2008
    The FEATHER_POLY I use consist of 7 different areas (non-overlapping) around 300 points within the GMW-file. They are on the format XXXXXX.XX0 , XXXXXXX.XX0. Where the last number is always zero. I guess it wont help much if I remove the 0`s at the end.

    I thought that the export with: LAYER_BOUNDS="newMosaikk.tif" would use the bounding rectangle of the selected file. At least the export file seems to generate correctly and equal to the input-size. I have tried to export the Mosaic-tile as a Shape-vector-file and used that as input to LAYER-BOUNDS, and I can not see a very big difference in processing time.
  • global_mapper
    global_mapper Administrator
    edited April 2008
    Sorry, I did not see the LAYER_BOUNDS parameter. You are correct that it will specify the layer bounds to use for the export.

    The format of the feather polygons does not make any difference as they are all ready into memory. The cause of your slowdown is most likely the polygons as the point-in-polygon and distance-to-polygon operations can slow things down a lot when feather blending. Other than simplifying your polygons to reduce the number of vertices there is not much that you can do.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • STH
    STH Global Mapper User Trusted User
    edited April 2008
    Thanks for the thorough, precise and good answer as always. If I someday during the summer I get some spare- time I will contact you and help with whatever needed to develop this great program further, as I see that you have too much to do. But still, too much to do is better than nothing to do I guess :)
  • tjhb
    tjhb Global Mapper User Trusted User
    edited June 2009
    You can clip an export to one or more selected area features on export, but there is not currently a way to do multiple exports based on multiple selected area features (i.e. one export per area feature). This is something that we are considering for a future release though.

    I'd like to add my vote for this feature (in scripting, possibly called POLYGON_CROP_USE_EACH?).

    An extra parameter would be useful, to specify the name of a column containing unique values to added as a suffix to each filename. (What should happen if the uniqueness condition failed? Should GM throw an error, or add a further numerical suffix?)

    This would be an extremely useful feature, often used. I have Manifold code to do the same job, but to have it in Global Mapper would make life much simpler.
  • global_mapper
    global_mapper Administrator
    edited June 2009
    I think a POLYGON_CROP_USE_EACH parameter should be doable now that the same functionality exists in the user interface. I'll throw that in and point you at a new v11 build when it is ready.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • tjhb
    tjhb Global Mapper User Trusted User
    edited June 2009
    Brilliant! Thanks Mike, I look forward to testing it.
  • global_mapper
    global_mapper Administrator
    edited June 2009
    I have completed adding support for a POLYGON_CROP_USE_EACH parameter and some supporting parameters for naming. There is a new v11 installer with this support at http://www.globalmapper.com/global_mapper_setup_v1100_beta1.exe that you can try.

    Here is the documentation of the new parameters:

    POLYGON_CROP_USE_EACH - specifies that if a POLYGON_CROP_FILE is specified that contains multiple polygons, the operation will generate a separate export for each polygons in that file rather than just the best-fit polygon. See the POLYGON_CROP_BBOX_ONLY and POLYGON_CROP_NAME_ATTR options for naming and other options when using this parameter. Use POLYGON_CROP_USE_EACH=YES to enable.

    POLYGON_CROP_BBOX_ONLY - specifies that if the POLYGON_CROP_USE_EACH parameter is specified that each export should just be cropped to the bounding box of each polygon rather than the actual boundary of the polygon. Use POLYGON_CROP_BBOX_ONLY=YES to enable only cropping to the bounding box.

    POLYGON_CROP_NAME_ATTR - used to control the filenames generated when cropping to multiple polygons using the POLYGON_CROP_USE_EACH parameter. This should be the actual name of the attribute from the polygon features to use for naming, or the special values <Area Display Label> or <Area Source Filename>. If no value is provided, the exported files will be sequentially numbered.

    Here is a sample script that I used to test:

    GLOBAL_MAPPER_SCRIPT VERSION=1.00

    // Import the file to split
    IMPORT FILENAME="O39094A3_bluespringsMO.TIF"

    // Export each feature to a Delorme file
    EXPORT_RASTER FILENAME="c:\temp\export test\split_test\BLUE_SPRINGS_DRG.TIF" \
    TYPE=GEOTIFF \
    POLYGON_CROP_FILE="crop_areas.gmp" \
    POLYGON_CROP_USE_EACH=YES \
    POLYGON_CROP_BBOX_ONLY=NO \
    POLYGON_CROP_NAME_ATTR="<Area Display Label>"

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • tjhb
    tjhb Global Mapper User Trusted User
    edited June 2009
    Mike that looks perfectly thought out. Thanks very much for bringing this in. I'll test the new build with my data and let you know.

    On a related note, I've made a bug report in that section of the forum for an apparent anomaly between the two GUI methods to perform the same thing. I.e. File|Export Raster and Elevation Data|Export GeoTIFF, and File|Batch Export/Reproject.