Global Mapper Pro

Generate_Elev_Grid with boundary

kgrover
kgrover Global Mapper UserTrusted User
edited January 2014 in GM Script Language
I am trying to write a script to process a folder of laz files into a surface, but with a cropped boundary. I have a map catalog created in the script, and a boundary in a shapefile, but I can't seem to get the Generate_Elev_Grid to work to clip it to the shapefile boundary.

I have tried both the layer_bounds and Polygon_Crop_File to try to use the shape file as the boundary, but it seems to ignore it.

Is there a way to do this?? The crop area is just a small portion of the overall dataset, and we tend to run this quite frequently.

Any help would be appreciated. Thanks.

Kevin

Comments

  • global_mapper
    global_mapper Administrator
    edited January 2014
    Kevin,

    The POLYGON_CROP_FILE wasn't supported for the GENERATE_ELEV_GRID command until just a few days ago. If you get v15.1.3 from Global Mapper Downloads then you should be able to use POLYGON_CROP_FILE with GENERATE_ELEV_GRID.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • kgrover
    kgrover Global Mapper User Trusted User
    edited January 2014
    Thanks Mike, I will give it a try!

    Kevin
  • kgrover
    kgrover Global Mapper User Trusted User
    edited January 2014
    So I downloaded the new version, and the polygon clip file option works great, now, but for some reason it isn't generating the whole surface I need. My script creates a map catalog of laz files, and imports this. Then it imports a shapefile for the boundary as shown in the image. Then I use the Generate_ELEV_GRID and use the Polygon_Crop_File option, and it crops the top part of my surface, but I get no data on the bottom part. Any ideas??

    Ideally, what I am after is to just create a surface within a boundary from a large folder of laz files. Maybe there is a problem with doing this from the Map Catalog.

    Thanks.

    Surface.JPG
  • global_mapper
    global_mapper Administrator
    edited January 2014
    What does the entire script look like? If you run the script in the context of the main map view, but just create and load the map catalog, then do the grid generation clipped to the polygon in the main user interface does that work? I'm just wondering if the issue if the great creation cropped to the polygon or with the new polygon cropping in the script.
    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • kgrover
    kgrover Global Mapper User Trusted User
    edited January 2014
    Here is the script. I have tried it both ways, to create the map catalog in the script, and the generate elevation, and as the script currently shows the import commented out, and I have been running it directly in the main interface on loaded data. I have also just tried loading about 3 or 4 of the laz file directly, then running this script on it, and get the same thing. If I just run the actual commands in GM it works fine, but thru the script it doesn't.

    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    //UNLOAD_ALL

    ////////////////////////////////////////////////////////////////////////////////////
    // Loop over all XYZ files in a folder and convert them to 1.0 meter Geotiff Surface
    ////////////////////////////////////////////////////////////////////////////////////

    //IMPORT FILENAME="D:\GM\Imports\ClipBoundary\Boundary.shp"

    // Create the map catalog. Maps should show when they take up at least 10% of display.
    // EDIT_MAP_CATALOG FILENAME="D:\GM\Imports\script_catalog.gmc" CREATE_IF_EMPTY=YES \
    // ADD_FILE="D:\GM\Imports\*.laz" ZOOM_DISPLAY="PERCENT,0.10,0"

    // Load the map catalog
    // IMPORT FILENAME="D:\GM\Imports\script_catalog.gmc"

    GENERATE_ELEV_GRID ELEV_UNITS=METERS SPATIAL_RES_METERS="1.0,1.0" BYTES_PER_SAMPLE=4\
    POLYGON_CROP_FILE="D:\GM\Imports\ClipBoundary\Boundary.shp"

    EXPORT_ELEVATION FILENAME="D:\GM\EXPORTS\merged_1m grid.tif" TYPE=GEOTIFF ELEV_UNITS=METERS\
    GEN_WORLD_FILE=YES SPATIAL_RES_METERS="1.0,1.0" BYTES_PER_SAMPLE=4\
    POLYGON_CROP_FILE="D:\GM\Imports\ClipBoundary\Boundary.shp"\
    OVERWRITE_EXISTING=YES COMPRESSION/LZW

    // UNLOAD_ALL

    Kevin
  • global_mapper
    global_mapper Administrator
    edited January 2014
    Kevin,

    Is there just a single area feature in the Boundary.shp file? If not then as it is now only the single best matching area would be used from the .SHP file. If you add POLYGON_CROP_USE_ALL=YES to the GENERATE_ELEV_GRID line then all of the polygons should be used.

    If that isn't it, can you send the .shp file so I can try it?

    Thanks,

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

    Yes, it is the only feature in the shp file. I will send you the shp file and a couple of the laz files by email.

    Thanks.

    Kevin
  • kgrover
    kgrover Global Mapper User Trusted User
    edited January 2014
    Mike,

    So I found out what is causing the problem, but not sure why. I removed the SPATIAL_RES_METERS="1.0,1.0" parameter from the GENERATE_ELEV_GRID command, and it works fine. As soon as I add it back in, or even the SPATIAL_RES parameter, it cuts the boundary off incorrectly.

    I sent you the files regardless, but not sure what is causing this.

    Kevin
Sign In or Register to comment.