pkascii2ogr(1)
π NAME π
okay bestie, meet pkascii2ogr β the icon, the moment, the little program that makes vector points or polygons out of a plain text file. literally that's the whole job. it's giving β¨glow-up for your .txtβ¨.
πΈ SYNOPSIS πΈ
pkascii2ogr [-i input] [-o output] [-f OGRformat] [-x col] [-y col]
[-line] [-n fieldname] [-ot type] [-fs separator]
π¦ DESCRIPTION π¦
so here's the tea: pkascii2ogr takes an ASCII textfile and builds a vector dataset out of it β either points or one single polygon. π
ngl, a better alternative is to use virtual vector datasets at http://www.gdal.org/drv_vrt.html. just saying. the manpage said it first, not me. π«Ά
you tell it where the vertices live by naming which columns hold the x and y β that's the -x and -y options, and columns start counting from 0, no cap. the default vibe is: first column (-dx 0) for x and second column (-dx 1) for y, respectively. π«
then for all the leftover columns in your input file, you declare their names and types with the option pairs -n and -ot. matching sets, bestie, keep them paired. π
default field separator? a plain old space. iconic, simple, we love her.
β¨ OPTIONS β¨
-i filename,--input filenameβ the input ASCII file, your raw material, the before picture πΈ-o filename,--output filenameβ the output file, the after picture π-f OGRformat,--f OGRformatβ the output sample file format π¨-x col,--x colβ which column number holds x (default0)-y col,--y colβ which column number holds y (default1)-l,--lineβ makes anOGRPolygonas the geometry instead of points. the fields get taken from the first point, and the polygon is automatically closed, so you do not need to repeat the first point on the last line (default isfalse: useOGRPoint) πΊ-n fieldname,--name fieldnameβ field names for the columns in your input ascii file π·οΈ-ot type,--otype typeβ the field type (Real,Integer,String) for each of the fields as defined by name π€-a_srs EPSG:number,--a_srs EPSG:numberβ override the projection for the output file; use anepsg:code or a Wkt string π-fs separator,--fs separatorβ the field separator πͺ-v n,--verbose nβ verbose, default0π£οΈ
π EXAMPLE π
ok so picture this: you wanna make a vector shape file (output.shp) out of an input ASCII file (input.txt). πΊοΈ
the coordinates β x (longitude) and y (latitude) β live in input.txt as columns 3 and 2 respectively (and yes, columns start counting from 0, we said what we said).
the remaining 2 columns in input.txt become fields (attributes) of type integer: id (column 0) and label (column 3). π·οΈ
and the projection is set to lat lon (epsg:4326). slay. π
pkascii2ogr -i input.txt -o output.shp -x 2 -x 1 -n id -ot Integer -n label -ot Integer -a_srs epsg:4326
π SEE ALSO π
pkascii2img(1)β her sister, also iconic π§
that's the whole page, bestie, you ate it up. π
this masterpiece is from the pkascii2ogr(1) manual page, dated 01 January 2025, and yes β pkascii2ogr(1) is right there in the corner being the main character it is. go forth and vectorize. βπ₯
π¦ where this page comes from
- ubuntu questing: pktools 2.6.7.6+ds-6build4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms