How to extract attribute values from shapefile for cpt file generation

I’m trying to figure out how to extract attributed data from a shapefile so I can construct a cpt file (makecpt). I have successfully plotted a map from the shapefile using:

gmt psxy $OUTPUT_GMT $REGION $PROJECTION -W0.05+cf -aZ=KAcreFt -Crainbow.cpt -K > $OUTPUT_PS

but cannot figure out how to extract the KAcreFt attribute into a file that I can use to generate a colormap. I’ve tried gmt convert but seem to end up with all of the vertices of all of the polygons with the attribute value as the 3-rd column. Any advice is welcome.


May be you can refer to Coloring OGR_GMT polygon files based on attribute column. The key point is -G+z that is provided by GMT 6.x