Projections

This section provides some basic recipes for reprojecting rasters and vectors, as well as, resampling imagery from the native resolution to a new user-defined resolution (ground sampling distance (GSD)).

Create projection for an existing image file

Quickly check to ensure that Geomatica is correctly installed and licensed for your computer. Use the Python interpreter in the terminal/console for quickly checking the install and licensing.

#UNDER CONSTRUCTION

Reproject an image from one coordinate system to a different coordinate system

This recipe uses a single Geomatica function to reproject an image from a UTM NAD83 projected coordinate system to a Latitude and Longitude WGS84 geographic coordinate system

from pci.reproj2 import reproj2

input_file = r"C:\projection\landsat8_ms.pix" #UTM NAD83 projection
reproj_file = r"C:\projection\reproj_image2.pix"
resolution = [2.0, 2.0]
map_units = "Long/Lat D000" #output will be longitude and latitude with WGS84

reproj2(input_file, [], [], "", reproj_file, "", "", "",
        [], resolution, "YES", map_units, "", "", "", "", "", "", "")

Reproject a vector layer from one coordinate system to a different coordinate system

This recipe uses a single Geomatica function to reproject a vector layer from a UTM NAD83 projected coordinate system to a Latitude and Longitude WGS84 geographic coordinate system

from pci.reproj2 import reproj2

input_file = r"C:\projection\toronto_vector.pix" #UTM NAD83 projection
vector_layers = [2,3]
reproj_file = r"C:\projection\reproj_vectors.pix"
resolution= [2.0, 2.0]
map_units = "Long/Lat D000" #output will be longitude and latitude with WGS83

reproj2(input_file, [], vector_layers, "VEC", reproj_file, "", "", "",
        [], resolution, "", map_units, "", "", "", "", "", "", "")

Resample Image channels

This recipe demonstrates how to change the ground sampling distance (GSD) or image resolution from the inpu resolution to 4m resolution, using a cubic convolution resampling method.

from pci.resamp import resamp

input_file = r"c:\data\image.pix" #2m resolution data
channels = [] #defaults to all channels
resampled_file = r"c:\data\resampled_image.pix"
resolution = [4.0, 4.0] #downsample from 2m to 4m resolution
resample_method ="cubic"

resamp(input_file, channels, [], "", resampled_file, "", "", resolution, resample_method)