---
name: "pkascii2ogr"
section: "1"
platform: "linux"
package: "pktools"
version: "2.6.7.6+ds-6+b3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pkascii2ogr"
---

# pkascii2ogr(1)

program to create vector points or polygons from text file

## NAME

pkascii2ogr - program to create vector points or polygons from text file

## SYNOPSIS

FC**pkascii2ogr**F\[0\]  \[FC**-i**F\[0\] *input*\] \[FC**-o**F\[0\] *output*\] \[FC**-f**F\[0\] *OGRformat*\] \[FC**-x**F\[0\] *col*\] \[FC**-y**F\[0\] *col*\] \[FC**-line**F\[0\]\] \[FC**-n**F\[0\] *fieldname*\] \[FC**-ot**F\[0\] *type*\] \[FC**-fs**F\[0\] *separator*\]

## DESCRIPTION

**pkascii2ogr** creates a vector dataset (points or single polygon) from an ASCII textfile. A better alternative is to use virtual vector datasets ⟨http://www.gdal.org/drv\_vrt.html⟩ . Specify the position of the vertices (x and y) in the columns defined by the options (FC**-x**F\[0\] FC**-y**F\[0\]), starting from 0. The default is to use the first (FC**-dx**F\[0\] 0) and second (FC**-dx**F\[0\] 1) columns for x and y respectvely. Specify the names and types of the remaining columns in your input file via the option pairs FC**-n**F\[0\] and FC**-ot**F\[0\] respectively. The default field separator is space.

## OPTIONS

- FC**-i**F\[0\] *filename*, FC**--input**F\[0\] *filename*

  input ASCII file

- FC**-o**F\[0\] *filename*, FC**--output**F\[0\] *filename*

  Output file

- FC**-f**F\[0\] *OGRformat*, FC**--f**F\[0\] *OGRformat*

  Output sample file format

- FC**-x**F\[0\] *col*, FC**--x**F\[0\] *col*

  column number of x (0)

- FC**-y**F\[0\] *col*, FC**--y**F\[0\] *col*

  column number of y (1)

- FC**-l**F\[0\], FC**--line**F\[0\]

  create OGRPolygon as geometry instead of points. Fields are taken from first point and polygon is automatically closed (no need to repeat first point at last line). (false: use OGRPoint)

- FC**-n**F\[0\] *fieldname*, FC**--name**F\[0\] *fieldname*

  Field names for the columns in the input ascii file

- FC**-ot**F\[0\] *type*, FC**--otype**F\[0\] *type*

  Field type (Real, Integer, String) for each of the fields as defined by name

- FC**-a\_srs**F\[0\] *EPSG:number*, FC**--a\_srs**F\[0\] *EPSG:number*

  Override the projection for the output file, use epsg: or Wkt string

- FC**-fs**F\[0\] *separator*, FC**--fs**F\[0\] *separator*

  field separator.

- FC**-v**F\[0\] *n*, FC**--verbose**F\[0\] *n*

  verbose (0)

## EXAMPLE

Create a vector shape file (FC*output.shp*F\[0\]) from input ASCII file (FC*input.txt*F\[0\]). The coordinates x (longitude) and y (latitude) can be found in FC*input.txt*F\[0\] as columns 3 and 2 respectively (columns start counting from 0). The remaining 2 columns in FC*input.txt*F\[0\] are used as fields (attributes) of type integer: id (column 0) and label (column 3). The projection is set to lat lon (epsg:4326).

```
FC
pkascii2ogr -i input.txt -o output.shp -x 2 -x 1 -n id -ot Integer -n label -ot Integer -a_srs epsg:4326
      F[0]
```

## SEE ALSO

[**pkascii2img**(1)](/pkascii2img/1.md)
