Sunday Tip Day: Convert a shapefile to text with linux
Never apologise for delayed posts… this is a Sunday Tip Day post, not a Thursday! Anyhow…
I just found a super little cross-platform utility that takes shapefiles and dumps them to a variety of text-based formats. Download it here, and simply unzip it to use it.
There isn’t much documentation, but basically your options are to download to gpx or spreadsheet. The following gives you a simple delimited text file with the coordinates and values from your attribute table:
./shp2text -–spreadsheet /path/to/your/shapefile.shp > /path/to/output.txt
Bob is indeed your mother’s brother.
Cool! Note that OGR (http://www.gdal.org/ogr/), more specifically ogr2ogr, will convert from/to a variety of GIS formats; work checking out.
s/work/worth/
There is also shpdump utility from Shapelib (http://shapelib.maptools.org/). Certainly, it does not use any format usable with popular GIS packages, but it’s useful for some simple & fast data investigation.
Tom, Mateusz, thanks for stopping by. What I particularly like about this little tool (and I’m not sure if the other options will do this- let me know if they do) is that it gives you the coordinates, even if you didn’t specifically record them as attributes. Very handy! I’ll look at shpdump though.