How automatically to import many files with coordinates in the name of the file?

Hello !
How automatically to import many files with coordinates in the name of the file?
Other parameters identicalI. Am not able to write scripts. Help please. Thanks.
Happy New Year ! 

424782.13813498715,281584.324152988,426117.7381349871,282415.099152988.png

FILENAME="C:\Downloads\HandyCacheRC\Cache\kartes.lgia.gov.lv\karte\proxy.ashx^\PNG15\424782.13813498715,281584.324152988,426117.7381349871,282415.099152988.png" 
GCP="Point 1,0.0000000,627.0000000,424782.1381350,281584.3241530" 
GCP="Point 2,1008.0000000,0.0000000,426117.7381350,282415.0991530" 
PROJ_NAME="TM_LKS92_LATVIA" 
Transverse Mercator
LKS92 (LATVIA)
SCALE FACTOR 0.9996
CENTRAL MERIDIAN 24
ORIGIN LATITUDE 0
FALSE EASTING (m) 500000
FALSE NORTHING (m) -6000000
ROTATION ANGLE 0



Answers

  • I have written a simple script for two files, his automation according to the list of many files is required.

    GLOBAL_MAPPER_SCRIPT VERSION="1.00"
    UNLOAD_ALL
    DEFINE_PROJ PROJ_NAME="TM_LKS92_LATVIA"
    Projection     TRANSVERSE
    Datum          D_LATVIA_1992
    Zunits         NO
    Units          METERS
    Xshift         0.000000
    Yshift         0.000000
    Parameters
    0.999600000 /* scale factor at central meridian

    24 0 0.000 /* central meridian

    0 0 0.000 /* latitude of the origin

    500000.000 /* false easting (meters)

    -6000000.000 /* false northing (meters)

    0 0 0.000 /* xy_plane_rotation

    END_DEFINE_PROJ
    LOAD_PROJECTION PROJ_NAME="TM_LKS92_LATVIA"

    IMPORT FILENAME="C:\Scripting_Data\Imagery_Tiles\399966.750233463,271777.88219531,401302.350233463,272617.9321953102.png" \
    TYPE="PNG" PROJ_NAME="TM_LKS92_LATVIA" RECTIFY="Automatic" GCP="Point 1,0.0000000,634.0000000,399966.750233463,271777.88219531" \
    GCP="Point 2,1008.0000000,0.0000000,401302.350233463,272617.9321953102" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" CLIP_COLLAR="NONE" \
    TEXTURE_MAP="NO"

    IMPORT FILENAME="C:\Scripting_Data\Imagery_Tiles\399968.075233463,278977.93219531036,401303.675233463,279817.9821953105.png" \
    TYPE="PNG" PROJ_NAME="TM_LKS92_LATVIA" RECTIFY="Automatic" GCP="Point 1,0.0000000,634.0000000,399968.075233463,278977.93219531036" \
    GCP="Point 2,1008.0000000,0.0000000,401303.675233463,279817.9821953105" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" CLIP_COLLAR="NONE" \
    TEXTURE_MAP="NO"

  • or As to connect it? :)

    IMPORT_DIR_TREE DIRECTORY="C:\Scripting_Data\Imagery_Tiles"

    ????????????????????????????????????????????/

    FILE LIST :
    X1,Y1,X2,Y2.png
    X1,Y1,X2,Y2.png
    X1,Y1,X2,Y2.png
    X1,Y1,X2,Y2.png
    ..............

    ( FILE - X1,Y1,X2,Y2.png )

    IMPORT FILENAME="C:\Scripting_Data\Imagery_Tiles\X1,Y1,X2,Y2.png" \
    TYPE="PNG" PROJ_NAME="TM_LKS92_LATVIA" RECTIFY="Automatic" GCP="Point 1,0.0000000,634.0000000,X1,Y1" \
    GCP="Point 2,1008.0000000,0.0000000,X2,Y2" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" CLIP_COLLAR="NONE" \
    TEXTURE_MAP="NO"

    (NEXT FILE )
  • I have improved the program. It is necessary to set still correctly X1,Y1,X2,Y2 from the name of the file. :)

    GLOBAL_MAPPER_SCRIPT VERSION="1.00"
    UNLOAD_ALL
    DEFINE_PROJ PROJ_NAME="TM_LKS92_LATVIA"
    Projection     TRANSVERSE
    Datum          D_LATVIA_1992
    Zunits         NO
    Units          METERS
    Xshift         0.000000
    Yshift         0.000000
    Parameters
    0.999600000 /* scale factor at central meridian
    24 0 0.000 /* central meridian
    0 0 0.000 /* latitude of the origin
    500000.000 /* false easting (meters)
    -6000000.000 /* false northing (meters)
    0 0 0.000 /* xy_plane_rotation

    END_DEFINE_PROJ

    DIR_LOOP_START DIRECTORY="C:\Scripting_Data\Imagery_Tiles\" FILENAME_MASKS="*.png"

    IMPORT FILENAME="%FNAME_W_DIR%" \
    TYPE="PNG" PROJ_NAME="TM_LKS92_LATVIA" RECTIFY="Automatic" GCP="Point 1,0.0000000,634.0000000,X1,Y1" \
    GCP="Point 2,1008.0000000,0.0000000,X2,Y2" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" CLIP_COLLAR="NONE" \
    TEXTURE_MAP="NO"

    DIR_LOOP_END

    X1=,Y1=,X2=,Y2 = ?????????????
  • One problem - use of parts of the name of the file for variables ! :)

    FOR SINGLE FILE 
    399966.750233463,271777.88219531,401302.350233463,272617.9321953102.PNG

    DEFINE_VAR NAME="X1" VALUE="399966.750233463"
    DEFINE_VAR NAME="Y1" VALUE="271777.88219531"
    DEFINE_VAR NAME="X2" VALUE="401302.350233463"
    DEFINE_VAR NAME="Y2" VALUE="272617.9321953102"

    IMPORT FILENAME="%FNAME_W_DIR%" \
    TYPE="PNG" PROJ_NAME="TM_LKS92_LATVIA" RECTIFY="Automatic" GCP="Point 1,0.0000000,634.0000000,%X1%,%Y1%" \
    GCP="Point 2,1008.0000000,0.0000000,%X2%,%Y2%" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" CLIP_COLLAR="NONE" \
    TEXTURE_MAP="NO"

    DEFINE VALUE FOR MORE FILES from the name of the file 
    VALUE="????????????????????" 
  • THIS WORKS !  
    But is necessary VAR NAME VALUE from FILENAME.!
    HELP ME ! :)

    GLOBAL_MAPPER_SCRIPT VERSION="1.00"
    UNLOAD_ALL
    DEFINE_PROJ PROJ_NAME="TM_LKS92_LATVIA"
    Projection     TRANSVERSE
    Datum          D_LATVIA_1992
    Zunits         NO
    Units          METERS
    Xshift         0.000000
    Yshift         0.000000
    Parameters
    0.999600000 /* scale factor at central meridian
    24 0 0.000 /* central meridian
    0 0 0.000 /* latitude of the origin
    500000.000 /* false easting (meters)
    -6000000.000 /* false northing (meters)
    0 0 0.000 /* xy_plane_rotation
    END_DEFINE_PROJ

    LOAD_PROJECTION PROJ_NAME="TM_LKS92_LATVIA"

    DEFINE_VAR NAME="ROW" VALUE="1"

    DIR_LOOP_START DIRECTORY="C:\Scripting_Data\Imagery_Tiles\" FILENAME_MASKS="*.png" 

    DEFINE_VAR_TABLE NAME="points" \
    FILENAME="C:\Scripting_Data\files_tab.csv"
    END_VAR_TABLE

    DEFINE_VAR NAME="ST" VALUE_TABLE="points" VALUE_COLUMN="ST" \
    COMPARE_STR="ST=%ROW%"
    DEFINE_VAR NAME="X1" VALUE_TABLE="points" VALUE_COLUMN="X1" \
    COMPARE_STR="ST=%ROW%"
    DEFINE_VAR NAME="Y1" VALUE_TABLE="points" VALUE_COLUMN="Y1" \
    COMPARE_STR="ST=%ROW%"
    DEFINE_VAR NAME="X2" VALUE_TABLE="points" VALUE_COLUMN="X2" \
    COMPARE_STR="ST=%ROW%"
    DEFINE_VAR NAME="Y2" VALUE_TABLE="points" VALUE_COLUMN="Y2" \
    COMPARE_STR="ST=%ROW%"

    IMPORT FILENAME="%FNAME_W_DIR%" \
    TYPE="PNG" PROJ_NAME="TM_LKS92_LATVIA" RECTIFY="Automatic" GCP="Point 1,0.0000000,634.0000000,%X1%,%Y1%" \
    GCP="Point 2,1008.0000000,0.0000000,%X2%,%Y2%" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" CLIP_COLLAR="NONE" \
    TEXTURE_MAP="NO"

    DEFINE_VAR NAME="ROW" FORMULA="%ROW%+1" CALC_MODE=NUMERIC

    DIR_LOOP_END
  • The variables X1,Y1,X2,Y2 formula for  use of 4 parts of the name of the file  is necessary ! 
  • NO PROBLEM !  :)

    GLOBAL_MAPPER_SCRIPT VERSION="1.00"
    UNLOAD_ALL
    DEFINE_PROJ PROJ_NAME="TM_LKS92_LATVIA"
    Projection TRANSVERSE
    Datum D_LATVIA_1992
    Zunits NO
    Units METERS
    Xshift 0.000000
    Yshift 0.000000
    Parameters
    0.999600000 /* scale factor at central meridian
    24 0 0.000 /* central meridian
    0 0 0.000 /* latitude of the origin
    500000.000 /* false easting (meters)
    -6000000.000 /* false northing (meters)
    0 0 0.000 /* xy_plane_rotation
    END_DEFINE_PROJ
    LOAD_PROJECTION PROJ_NAME="TM_LKS92_LATVIA"

    DIR_LOOP_START DIRECTORY="C:\Scripting_Data\Imagery_Tiles\" FILENAME_MASKS="*.png" 

    DEFINE_VAR NAME="Z" VALUE="%FNAME_WO_EXT%"
    DEFINE_VAR NAME="X1" FORMULA="clip(Z, '', ',')"
    DEFINE_VAR NAME="Y1" FORMULA="clip(clip(Z, ',', ''), '', ',')"
    DEFINE_VAR NAME="X2" FORMULA="clip(clip(clip(Z, ',', ''), ',', ''), '', ',')"
    DEFINE_VAR NAME="Y2" FORMULA="clip(clip(clip(Z, ',', ''), ',', ''), ',', '')"

    IMPORT FILENAME="%FNAME_W_DIR%" \
    TYPE="PNG" PROJ_NAME="TM_LKS92_LATVIA" RECTIFY="Automatic" GCP="Point 1,0.0000000,634.0000000,%X1%,%Y1%" \
    GCP="Point 2,1008.0000000,0.0000000,%X2%,%Y2%" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" CLIP_COLLAR="NONE" \
    TEXTURE_MAP="NO" TRANSPARENT_COLOR="RGB(255,255,255)" 

    DIR_LOOP_END

    DEFINE_PROJ PROJ_NAME="MERCAT_WGS84"
    Projection MERCATOR
    Datum WGS84
    Zunits NO
    Units METERS
    Xshift 0.000000
    Yshift 0.000000
    Parameters
    1.000000000 /* scale factor at central meridian
    0 0 0.000 /* central meridian
    0 0 0.000 /* latitude of the origin
    0.000 /* false easting (meters)
    0.000 /* false northing (meters)

    END_DEFINE_PROJ
    LOAD_PROJECTION PROJ_NAME="MERCAT_WGS84"

  • MykleMykle Global Mapper User Posts: 405Trusted User
    Well done! And thank you for sharing your scripts.
  • igorsldkigorsldk Posts: 21
    I modify Formula

    DEFINE_VAR NAME="Z" VALUE="%FNAME_WO_EXT%"
    DEFINE_VAR NAME="X1" FORMULA="clip(Z, '', ',')"
    DEFINE_VAR NAME="Y1" FORMULA="clip(Z, ',', ',')"
    DEFINE_VAR NAME="X2" FORMULA="clip(clip(Z, ',', ''), ',', ',')"
    DEFINE_VAR NAME="Y2" FORMULA="clip(clip(clip(Z, ',', ''), ',', ''), ',', '')"
Sign In or Register to comment.