SHIFT_LAYER
The SHIFT_LAYER command moves a layer by the specified offset.
The following parameters are supported by the command:
- FILENAME - filename of the layer to split. If an empty value is passed in, all loaded vector layers will be split. This parameter can be listed more than once to specify multiple input files, like FILENAME="FILENAME_1" FILENAME="FILENAME_2". When running the script in the context of the main map view (including loading a workspace) you can also pass in the value 'USER CREATED FEATURES' to have the 'User Created Features' layer split or 'SELECTED LAYERS' to have any layers selected in the Control Center split. If you don't pass anything in all loaded layers will be operated on.
- COORD_OFFSET - specifies the offset to apply to any coordinates for the features that match the specified criteria. The offset should be specified as a comma-delimited list of the X and Y offsets (and optionally Z), such as COORD_OFFSET="100000.0,200000.0". If you just want to shift in the Z direction, specify 0 for the X and Y shifts. For example, to shift by 5 units in the Z direction, use COORD_OFFSET="0,0,5".
- COORD_OFFSET_UNITS - String representing units to use to interpret value obtained by "COORD_OFFSET". Accepts "M" (meters), "METERS", "FT", "FEET", "KM", "MILES", "NM" (nautical miles), "DEGREES" (arc degrees) or any other unit name from the projection dialog. Defaults to meters. e.g. COORD_OFFSET_UNITS="FT"
-
Layer Rectification/ Control Points
The parameters below allow defining a series of control points and rectification parameters for setting up a coordinate mapping from pixel space to real-world projection coordinates for the layer.
- HAS_3D_POINTS - If HAS_3D_POINTS=YES is used, then the control points will have a Z component after each XY value. If 3D control points are provided, they will shift Lidar, 3D vectors or 3D model layers using the best-fit 3D transform.
- GCP - specifies a single ground control point for use in rectifying a file. The GCP record consists of 5 comma-delimited fields, the control point name, the pixel X and Y coordinates, and the corresponding ground X and Y coordinates. A separate GCP parameter and value should be used for each control point used in the rectification. As an alternative, the GCP_FILENAME parameter (see below) can be used instead.
When HAS_3D_POINTS is used the expected values are like GCP="name,x_from,y_from,z_from,x_to,y_to,z_to" - GCP_FILENAME - specifies the name of a control point file used to rectify the file being imported. the expected format in the file when HAS_3D_POINTS is provided is: x_from,y_from,z_from,x_to,y_to,z_to,name. Note the name is optional.
- GCP_PROJ_NAME - specifies the name of the projection that the ground control points are provided in. This name must have been defined with a prior DEFINE_PROJ command. Use this if you want to specify control points in a projection other than what you want to define as the native projection for the file. Note that you must also explicitly specify the name projection of the file using either the PROJ, PROJ_NAME, PROJ_EPSG_CODE or PROJ_FILENAME parameters.
- TRANSFORM_FILENAME - specifies the name of a control point file used to transform the coordinates of the imported file. This is different than the GCP_FILENAME in that the file defines a mapping of world coordinates to a new set of world coordinates rather than pixel coordinates to world coordinates. Each line should be of the format: x_orig,y_orig,x_new_y_new
- GCP_PROJ_FILENAME - specifies the name of the projection (.prj) file that contains the projection definition for the projection that the ground control points are provided in. Use this if you want to specify control points in a projection other than what you want to define as the native projection for the file. Note that you must also explicitly specify the name projection of the file using either the PROJ, PROJ_NAME, PROJ_EPSG_CODE or PROJ_FILENAME parameters.
- GCP_PROJ_EPSG_CODE - specifies the EPSG code of the projection that the ground control points are provided in. Use this if you want to specify control points in a projection other than what you want to define as the native projection for the file. Note that you must also explicitly specify the name projection of the file using either the PROJ, PROJ_NAME, PROJ_EPSG_CODE or PROJ_FILENAME parameters.
- RECTIFY - specifies the rectification method to use for rectifying this file. Valid value are LINEAR, HELMERT, AFFINE, POLYNOMIAL, and TRIANGULATION. If you do not specify a rectification type but do provide at least two ground control points, the best rectification method will automatically be chosen based on the number of control points specified.
- RECTIFY_4_POINT_POLY_ONLY - specifies that if RECTIFY=POLYNOMIAL is used to specify the rectification method, the polynomial will always be a 1st degree polynomial and won't switch automatically to a 2nd degree polynomial at 6 or more points. By default, the 2nd degree polynomial will automatically be used
Example: Shift a layer by 500 meters in the X direction and 300 meters in the Y direction.
SHIFT_LAYER FILENAME="BackCove_base.tif" COORD_OFFSET="500,300" COORD_OFFSET_UNITS="M"
Here are 2 sample SHIFT_LAYER script commands to shift an already loaded Lidar GMP file using a 3D shift:
// Shift layer by the control point file
SHIFT_LAYER GCP_FILENAME="augusta_xform_3d.txt" HAS_3D_POINTS=YES
// Shifting by inline GCPs
SHIFT_LAYER HAS_3D_POINTS=YES \
GCP="(X+2;Y+1;Z+0.45),437527.500,4906329.450,49.55,437529.500,4906330.450,50" \
GCP="(X+1.5;Y+0.5;Z+0.11),437652.260,4906246.210,64.89,437653.310,4906246.710,65" \
GCP="(X-0.1;Y+0.01;Z-0.13),437993.600,4906317.620,46.63,437993.500,4906317.630,46.5" \
GCP="(X-2;Y-1;Z-0.5),438118.080,4906109.990,20.60,438116.080,4906108.990,20.10"