[GRASSLIST:5707] v.in.shape - cannot import multiple attributes/categories to one layer

Philipp Molzer phil at molzer.net
Sun Mar 2 12:29:28 EST 2003


Hi,
I'm running grass5.0.0 on RedHat8.0
I'm trying to import an arcinfo vector .shp file with several attribute 
fields, using v.in.shape.  It seems to me that I should be able to 
create a single layer with all the attributes. But all I can figure out 
how to do is to create a separate layer for each attribute, which seems 
like a waste of disk space.  

Also, attributes of type text or int need to be imported with 
label=attribute_name while attributes of type float need to be imported 
with attribute=attribute_name, which seems weird to me.

Then when I want to plot them with d.vect.labels, I have to use option 
attr=cat or attr=string, depending on how I imported the layer.

What's the right way to do this?

Here's how I've been doing it:

source file is esstrct.shp
Attribute fields available in esstrct.shp:
1: AREA [float4:18]
2: PERIMETER [float4:18]
3: ESSTRCT_ [int8:11]
4: ESSTRCT_ID [int8:11]
5: CTBNA [text:6]
6: FREQUENCY [int8:11]
7: SUM_TOTALP [float4:18]

The import script:
BASE=/DATA/GIS/NJ/ESSEX
SHP=esstrct
g.region rast=essexdem
cd ${BASE}/$SHP
for ATT in AREA PERIMETER SUM_TOTALP ; do
  v.in.shape -o in=${SHP}.shp out=${SHP}_$ATT attribute=$ATT scale=24000
  v.support map=${SHP}_$ATT option=build
  d.vect.labels -m -v map=${SHP}_$ATT color=red  attr=cat
done

for ATT in ESSTRCT_ ESSTRCT_ID CTBNA FREQUENCY ; do
  v.in.shape -o in=${SHP}.shp out=${SHP}_$ATT label=$ATT scale=24000
  v.support map=${SHP}_$ATT option=build
  d.vect.labels -m -v map=${SHP}_$ATT color=white  attr=string
done

Phil




More information about the grass-user mailing list