GM-16 - Scripting - Global_Mapper_18_GMutils v.1.0 by GeoX - GIS_OFERTA_KARTOGRAFIA_NAWIGACJA_GPS_LIDAR

Global_Mapper_18_GMutils v.1.0 by GeoX - GIS_OFERTA_KARTOGRAFIA_NAWIGACJA_GPS_LIDAR

Idź do spisu treści

Menu główne

GM-16 - Scripting

GlobalMapper > O Programie

W Global Mapper v. 16 rozwinięto możliwości tworzenia skryptów wykonawczych użytkownika.

Opis wszyskich funkcji SCRIPTING znajduje się
tutaj oraz tutaj

Przykładowe skrypty:

Sample Scripts
Below are some samples of Global Mapper scripts, notice that the comments on each scripts are placed after a '/'. This means that the script will still function, with the explanations contained.

Import a file

GLOBAL_MAPPER_SCRIPT VERSION="1.00"
IMPORT FILENAME="C:_Data_TilesTDK365050.jp2"
// Import files, specifying the full directory location and including the file type extension.

Import Multiple Files

GLOBAL_MAPPER_SCRIPT VERSION="1.00"

IMPORT FILENAME="C:_Data_TilesTDK365050.jp2"
IMPORT FILENAME="C:_Data_TilesTDK365065.jp2"
IMPORT FILENAME="C:_Data_TilesTDK380050.jp2"
IMPORT FILENAME="C:_Data_TilesTDK380065.jp2"

Import Multiple Shapefiles and Export to Multiple KML Files

GLOBAL_MAPPER_SCRIPT VERSION="1.00"
DIR_LOOP_START DIRECTORY=C:_DataFILENAME_MASKS="*.shp"
IMPORT FILENAME="%FNAME_W_DIR%"
// Import all shapefiles, of any name, from specified import directory location
EXPORT_VECTOR FILENAME="C:_Data_WO_EXT%.KML" TYPE=KML
UNLOAD_ALL
DIR_LOOP_END
// Export all KML files to specified export directory location

Crop, Merge, and Reproject

GLOBAL_MAPPER_SCRIPT VERSION=1.00
UNLOAD_ALL
// Import the four 24K DRGs that we want to merge. We use the CLIP_COLLAR option
// to indicate that we want the collar to be automatically removed from the
// DRGs when they are imported.
IMPORT FILENAME="C:CITYB2.TIF"\par    TYPE=AUTO ANTI_ALIAS=NO AUTO_CONTRAST=NO CLIP_COLLAR=AUTO TEXTURE_MAP=NO
IMPORT FILENAME="C:CITYA1.TIF"\par    TYPE=AUTO ANTI_ALIAS=NO AUTO_CONTRAST=NO CLIP_COLLAR=AUTO TEXTURE_MAP=NO
IMPORT FILENAME="C:CITYA2.TIF"\par    TYPE=AUTO ANTI_ALIAS=NO AUTO_CONTRAST=NO CLIP_COLLAR=AUTO TEXTURE_MAP=NO
IMPORT FILENAME="C:CITYB1.TIF"\par    TYPE=AUTO ANTI_ALIAS=NO AUTO_CONTRAST=NO CLIP_COLLAR=AUTO TEXTURE_MAP=NO
// Load a projection file to set the global projection to geographic (lat/lon)
// arc degrees with a datum of NAD83.
LOAD_PROJECTION FILENAME="C:Files_degrees_nad83.prj"
// Use the EXPORT_RASTER command to generate a new 8-bit per pixel GeoTIFF file
EXPORT_RASTER FILENAME="C:DATA_drg_8bpp.tif"\par    TYPE=GEOTIFF PALETTE=OPTIMIZED
// Now, use the EXPORT_RASTER command to generate a grayscale GeoTIFF file. Lets
// also create a world file for this one
EXPORT_RASTER FILENAME="C:DATA_drg_gray.tif"\par    TYPE=GEOTIFF PALETTE=GRAYSCALE GEN_WORLD_FILE=YES
// Create a JPEG file using the EXPORT_RASTER command. Also create a world file
// and a projection file to make it easier to load in other places.
EXPORT_RASTER FILENAME="C:DATA_drg.jpg"\par    TYPE=JPEG GEN_WORLD_FILE=YES GEN_PRJ_FILE=YES

Generate Contours from all USGS DEMs

GLOBAL_MAPPER_SCRIPT VERSION=1.00
UNLOAD_ALL
// Loop over all DEM files in a folder and convert them
DIR_LOOP_START DIRECTORY="C:_DEMKFILENAME_MASKS="*.DEM.STDS.TAR.GZ" RECURSE_DIR=NO
// Import an archived SDTS DEM file. Global Mapper will automatically
// determine that this is an archived SDTS DEM file and load it
// correctly.
IMPORT FILENAME="%FNAME_W_DIR%" ANTI_ALIAS=YES
// Generate 50 ft contours from the loaded DEM data.
GENERATE_CONTOURS INTERVAL=50 ELEV_UNITS=FEET
// Export the contours to a new DXF file. The created file will have
// 3D polyline features for the contours.
EXPORT_VECTOR FILENAME="%DIR%%FNAME_WO_EXT%_CONTOURS.DXF" TYPE=DXF GEN_PRJ_FILE=YES
// Export the contours to a 3D shape file.
EXPORT_VECTOR FILENAME="%DIR%%FNAME_WO_EXT%_CONTOURS.SHP" TYPE=SHAPEFILE\par  SHAPE_TYPE=LINES GEN_3D_LINES=YES GEN_PRJ_FILE=YES
// Unload the loaded data
UNLOAD_ALL
// End the loop
DIR_LOOP_END

Edit Vector Features Based on an Attribute and Display Label

GLOBAL_MAPPER_SCRIPT VERSION=1.00
// Import the file to modify
IMPORT FILENAME="C:test_wyandotte_sample.gmp"
// Assign the type "railroad" to all features with a CFCC attribute with a value of A41
// and a display label with '74' in it somewhere.
EDIT_VECTOR LINE_TYPE="RAILROAD" COMPARE_STR="CFCC=A41" COMPARE_STR="<Feature Name>=*74*"
// Assign the name "Burlington Northern Railroad" to all features with a CFCC attribute with a value of A41
EDIT_VECTOR ATTR_VAL="<Feature Name>=Burlington Northern Railroad" COMPARE_STR="CFCC=A41"

 
Wróć do spisu treści | Wróć do menu głównego