'\" -*- coding: UTF-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH pkascii2img 1 "06 December 2020" "" "" .SH NAME pkascii2img \- program to create raster image based on ascii file .SH SYNOPSIS 'nh .fi .ad l \fBpkascii2img\fR \kx .if (\nx>(\n(.l/2)) .nr x (\n(.l/5) 'in \n(.iu+\nxu [\fB-i\fR \fIinput\fR] [\fB-o\fR \fIoutput\fR] [\fB-ot\fR \fItype\fR] [\fB-of\fR \fIGDALformat\fR] [\fB-co\fR \fINAME=VALUE\fR] [\fB-dx\fR \fIvalue\fR] [\fB-dy\fR \fIvalue\fR] [\fB-ulx\fR \fIvalue\fR] [\fB-uly\fR \fIvalue\fR] [\fB-ct\fR \fIfilename\fR] [\fB-a_srs\fR \fIEPSG:number\fR] [\fB-d\fR \fIdescription\fR] 'in \n(.iu-\nxu .ad b 'hy .SH DESCRIPTION \fBpkascii2img\fR creates a raster dataset from an ASCII textfile. The textfile is in matrix format (rows and columns). The dimensions in x and y are defined by the number of columns and rows respectively. The georeferencing can be defined by providing the options for cell size (\*(T<\fB\-dx\fR\*(T> \*(T<\fB\-dy\fR\*(T>), upper left position (\*(T<\fB\-ulx\fR\*(T> \*(T<\fB\-uly\fR\*(T>) and the projection (\*(T<\fB\-a_srs\fR\*(T>). Some dataset formats can also store a description (\*(T<\fB\-d\fR\*(T>) and a color table (\*(T<\fB\-ct\fR\*(T>). .SH OPTIONS .TP \*(T<\fB\-i\fR\*(T> \fIfilename\fR, \*(T<\fB\-\-input\fR\*(T> \fIfilename\fR input ASCII file .TP \*(T<\fB\-o\fR\*(T> \fIfilename\fR, \*(T<\fB\-\-output\fR\*(T> \fIfilename\fR Output image file .TP \*(T<\fB\-ot\fR\*(T> \fItype\fR, \*(T<\fB\-\-otype\fR\*(T> \fItype\fR Data type for output image ({Byte / Int16 / UInt16 / UInt32 / Int32 / Float32 / Float64 / CInt16 / CInt32 / CFloat32 / CFloat64}). Empty string: inherit type from input image .TP \*(T<\fB\-of\fR\*(T> \fIGDALformat\fR, \*(T<\fB\-\-oformat\fR\*(T> \fIGDALformat\fR Output image format (see also \fBgdal_translate\fR(1)). Empty string: inherit from input image .TP \*(T<\fB\-co\fR\*(T> \fINAME=VALUE\fR, \*(T<\fB\-\-co\fR\*(T> \fINAME=VALUE\fR Creation option for output file. Multiple options can be specified. .TP \*(T<\fB\-ulx\fR\*(T> \fIvalue\fR, \*(T<\fB\-\-ulx\fR\*(T> \fIvalue\fR Upper left x value bounding box (in geocoordinates if georef is true) .TP \*(T<\fB\-uly\fR\*(T> \fIvalue\fR, \*(T<\fB\-\-uly\fR\*(T> \fIvalue\fR Upper left y value bounding box (in geocoordinates if georef is true) .TP \*(T<\fB\-dx\fR\*(T> \fIvalue\fR, \*(T<\fB\-\-dx\fR\*(T> \fIvalue\fR Output resolution in x (in meter) .TP \*(T<\fB\-dy\fR\*(T> \fIvalue\fR, \*(T<\fB\-\-dy\fR\*(T> \fIvalue\fR Output resolution in y (in meter) .TP \*(T<\fB\-ct\fR\*(T> \fIfilename\fR, \*(T<\fB\-\-ct\fR\*(T> \fIfilename\fR colour table in ASCII format having 5 columns: id R G B ALFA (0: transparent, 255: solid) .TP \*(T<\fB\-a_srs\fR\*(T> \fIEPSG:number\fR, \*(T<\fB\-\-a_srs\fR\*(T> \fIEPSG:number\fR Override the projection for the output file .TP \*(T<\fB\-d\fR\*(T> \fIdescription\fR, \*(T<\fB\-\-description\fR\*(T> \fIdescription\fR Set image description .TP \*(T<\fB\-v\fR\*(T>, \*(T<\fB\-\-verbose\fR\*(T> verbose .SH EXAMPLE We create a 5x5 raster dataset containing all 0 values except for its center (value=1) .PP .nf \*(T< \fBcat\fR \fIinput.txt\fR 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 \*(T> .fi .PP We define a pixel size of 25 by 25 m and and a projected in the European projection system ETS89/LAEA. The location of the upper left pixel is also set: .PP .nf \*(T< \fBpkascii2img\fR \fB\-i\fR \fIinput.txt\fR \fB\-o\fR \fIoutput.tif\fR \fB\-of\fR \fIGTiff\fR \fB\-a_srs\fR \fIepsg:3035\fR \fB\-dx\fR \fI25\fR \fB\-dy\fR \fI25\fR \fB\-ulx\fR \fI1000000\fR \fB\-uly\fR \fI1000000\fR \*(T> .fi .PP We check the output GeoTIFF using \fBgdalinfo\fR: .PP .nf \*(T< \fBgdalinfo\fR \fIoutput.tif\fR Driver: GTiff/GeoTIFF Files: output.tif Size is 5, 5 Coordinate System is: PROJCS["ETRS89 / LAEA Europe", GEOGCS["ETRS89", DATUM["European_Terrestrial_Reference_System_1989", SPHEROID["GRS 1980",6378137,298.2572221010042, AUTHORITY["EPSG","7019"]], TOWGS84[0,0,0,0,0,0,0], AUTHORITY["EPSG","6258"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4258"]], PROJECTION["Lambert_Azimuthal_Equal_Area"], PARAMETER["latitude_of_center",52], PARAMETER["longitude_of_center",10], PARAMETER["false_easting",4321000], PARAMETER["false_northing",3210000], UNIT["metre",1, AUTHORITY["EPSG","9001"]], AUTHORITY["EPSG","3035"]] Origin = (1000000.000000000000000,1000000.000000000000000) Pixel Size = (25.000000000000000,\-25.000000000000000) Metadata: AREA_OR_POINT=Area TIFFTAG_DATETIME=2014:11:08 11:33:52 TIFFTAG_DOCUMENTNAME=output.tif TIFFTAG_SOFTWARE=pktools 2.5.4 by Pieter Kempeneers Image Structure Metadata: INTERLEAVE=BAND Corner Coordinates: Upper Left ( 1000000.000, 1000000.000) ( 23d13' 9.44"W, 25d30'21.01"N) Lower Left ( 1000000.000, 999875.000) ( 23d13' 8.02"W, 25d30'17.24"N) Upper Right ( 1000125.000, 1000000.000) ( 23d13' 5.27"W, 25d30'22.72"N) Lower Right ( 1000125.000, 999875.000) ( 23d13' 3.85"W, 25d30'18.95"N) Center ( 1000062.500, 999937.500) ( 23d13' 6.65"W, 25d30'19.98"N) Band 1 Block=5x5 Type=Byte, ColorInterp=Gray gdalinfo output.tif Driver: GTiff/GeoTIFF Files: output.tif Size is 5, 5 Coordinate System is: PROJCS["ETRS89 / LAEA Europe", GEOGCS["ETRS89", DATUM["European_Terrestrial_Reference_System_1989", SPHEROID["GRS 1980",6378137,298.2572221010042, AUTHORITY["EPSG","7019"]], TOWGS84[0,0,0,0,0,0,0], AUTHORITY["EPSG","6258"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4258"]], PROJECTION["Lambert_Azimuthal_Equal_Area"], PARAMETER["latitude_of_center",52], PARAMETER["longitude_of_center",10], PARAMETER["false_easting",4321000], PARAMETER["false_northing",3210000], UNIT["metre",1, AUTHORITY["EPSG","9001"]], AUTHORITY["EPSG","3035"]] Origin = (1000000.000000000000000,1000000.000000000000000) Pixel Size = (25.000000000000000,\-25.000000000000000) Metadata: AREA_OR_POINT=Area TIFFTAG_DATETIME=2014:11:08 11:33:52 TIFFTAG_DOCUMENTNAME=output.tif TIFFTAG_SOFTWARE=pktools 2.5.4 by Pieter Kempeneers Image Structure Metadata: INTERLEAVE=BAND Corner Coordinates: Upper Left ( 1000000.000, 1000000.000) ( 23d13' 9.44"W, 25d30'21.01"N) Lower Left ( 1000000.000, 999875.000) ( 23d13' 8.02"W, 25d30'17.24"N) Upper Right ( 1000125.000, 1000000.000) ( 23d13' 5.27"W, 25d30'22.72"N) Lower Right ( 1000125.000, 999875.000) ( 23d13' 3.85"W, 25d30'18.95"N) Center ( 1000062.500, 999937.500) ( 23d13' 6.65"W, 25d30'19.98"N) Band 1 Block=5x5 Type=Byte, ColorInterp=Gray \*(T> .fi .SH "SEE ALSO" \fBpkascii2ogr\fR(1)