Plotting and labeling shapefiles with -a (aspatial data)

I have a shapefile that outlines magnetic lineations that I created in QGIS. The shapefile has attributes that label the individual vectors/lines with the chron.

I want to plot the shapefile, and then label the chron lines with the respective chron assignment. I only want the magnetic lineations labeled once.

“chron” is the name of the attribute.

    # Plot the shapefile
    gmt plot $SHAPEFILE.shp -W1p,blue -aT=chron

I calculate the midpoints of the vectors, and export them to a text file. I can’t seem to export the “chron” attribute along with the vector midpoint. It just exports the lon/lat.

   # Calculate the midpoints of the vectors and extract the attribute
  gmt spatial $SHAPEFILE.shp -Qk -fg -aL=chron | gmt convert -i0,1 > midpoints.txt

Is there a way to label my segments from a shapefile using attributes?

Thanks!

I’m not very fan of -a and shapes in GMT CLI, so I know little about it but that -i0,1 clearly drops anything else than the x,y coordinates.

1 Like