CSV2SHP(1)

πŸ“¦
version 1.6.3 Β· 4 versions
, in ubuntu stonking

πŸ’– CSV2SHP β€” okay bestie, let's make a shapefile πŸ’–

So there's this little icon csv2shp and its whole thing is converting a character delimited file into an ESRI shapefile. That's it. That's the job. And it's from shplib, which β€” respectfully β€” ate. 🫢


✨ NAME ✨

csv2shp β€” converts a character delimited file to a ESRI shapefile πŸ’…


🌸 SYNOPSIS 🌸

csv2shp csv_filename delimiter_character shp_filename

        fprintf(stderr,
                "csv2shp csv_filename delimiter_character shp_filename\n");
        fprintf(stderr, "   csv_filename\n");
        fprintf(stderr,
                "     columns named longitude and latitude must exist\n");
        fprintf(stderr, "   delimiter_character\n");
        fprintf(stderr, "     one character only\n");
        fprintf(stderr, "   shp_filename\n");
        fprintf(stderr,
                "     base name, do not give the extension\n");
        return EXIT_FAILURE;
That's literally the usage message right there in the synopsis, no cap. Three arguments, that's the whole vibe check.

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so first thing's first, and this is important, so listen: this program operates on single points only β€” not polygons, not lines. Points. Just points. If you came here for lines or polygons, this is not it, sorry babe 😭

The input file can be a .csv file (comma separated values), or tab-separated values, or honestly separated by any other character you want. Your file, your rules.

The first row must contain column names. Mandatory. And there has to be a column named longitude and a column named latitude in there β€” both of them, no skipping. πŸ”₯

Now for the part where I have to be the bearer of bad news πŸ™ˆ: the .csv parser does not understand text delimiters (like a quotation mark, for example). It parses fields only by the given field delimiter (so like a comma, or a tab). That's the only thing it's looking at. Periodt.

Also β€” and I cannot stress this enough β€” the program has not been tested with null values, and in that case the behavior is undefined. Not "probably fine", not "yolo", undefined. Like, genuinely undefined behavior. And it will not accept lines with a trailing delimiter character. Just won't. Don't do it.

Good news though: all columns (yes, including longitude and latitude) in the input file get exported to the .dbf file. Nothing gets left behind. πŸ‘‘

Oh and it's smart about it too β€” the program attempts to find the best type (integer, decimal, string) and the smallest size of the fields necessary for the .dbf file. It's optimizing. It's doing the most, in a good way. slay πŸ’…


πŸŽ€ OPTIONS πŸŽ€

  • csv_filename β€” bestie, there must exist columns named longitude and latitude. Non-negotiable.
  • delimiter_character β€” one character only. One. Uno. Single. Don't try to be cute with it.
  • shp_filename β€” this is a base name, so do not give the extension. Leave it off, trust. πŸ’–

Friendly reminder: points only, no nulls (undefined behavior!! 😱), no trailing delimiters, and your first row better have column names. iykyk.

byeee bestie, go make some shapefiles πŸ’–βœ¨πŸ¦‹πŸŒΈ

That's CSV2SHP(1) from shplib, dated March 2026. Mwah. 🫢

πŸ“¦ where this page comes from