v.in.dxf & v.cadlabel
records at zorro.cecer.army.mil
Wed Jun 23 13:56:00 EDT 1993
Has anyone answered your questions yet? If not I can take a stab at them.
P.S. I haven't used any of these programs in a while. Could be they've
In an E-mail message, Teresa Hansen wrote:
> Help! I'm having trouble importing elevation data from AutoCad. The DXF
> data I'm importing has 40 layers (3/4 line layers, 1/4 label layers) and
> takes up gobs of disk space. Two of these layers contain contour data.
> Another layer contains the contour text (elevations) and still another
> contains spot elevations (line & label info on the same layer). All of the
> rest of the layers contain buildings, fences, trails, roads, etc. This DXF
> data also is in the State Plane NAD 27 coordinate system which I nee> d to
> transform into UTM NAD 83.
> What I've concluded that I need to do is:
> 1) run v.in.dxf
> 2) run v.support on all 40 layers (because v.cadlabel evidently needs
> topological info to run)
At this point, I wanted to point out that it is in your best interest to run
v.support ANYTIME you are importing or creating a vector data layer. This
program gives you valuable information about any potential problems with the
data layer. HOWEVER, you don't need to run v.support at this exact time. That
can wait until after you've transformed your file to a state plane coordinate
system and then converted it back to binary vector format (see step 5).
> 3) run v.out.ascii on all 40 layers to convert the layers into ASCII format
> so that v.transform can operate
You don't need to do this as there is an option in v.in.dxf that takes the DXF
file and brings it into GRASS in a dig_ascii format so that it's ready to be
transformed without any more steps.
v.in.dxf -a <DXF filename>
Also, who says you need to run this on all 40 files? Do you actually need the
data on all the levels? I find that most DXF files have a lot of stuff that I
don't really need, so I use only the levels I'm, interested and discard
anything I don't care about. It's really easiest to do this in the CADD system
before you create the DXF file, so that the DXF file contains only the levels
that you're interested in. But this may not have been an option that was
available to you. If you do need to keep all 40 files, then you can develop
some simple scripts to do some of the more automatable of the procedures.
> 4) run v.transform on all 40 layers using a points file which contains 10
> State Plane NAD 27 points with their corresponding UTM NAD 83 values
> (thankfully we have a "CorpsCon" program which can perform this
> 5) run v.in.ascii on all 40 layers to convert the layers back to binary
> format (necessary for v.cadlabel, v.patch, etc.).
This is where you can write a little executible script that does something
v.in.ascii input=ascii.1 output=binary.1
v.in.ascii input=ascii.2 output=binary.2
Also, after you run this program you'll need to run v.support on all of
the files. A similar executable script can be devised for this task:
v.support map=binary.1 option=build
v.support map=binary.2 option=build
> 6) run v.cadlabel on the two contour line layers and their associated labels
> layer (to attach the labels to their respective contour lines).
> 7) and finally, run v.patch a number of times to conglomerate all of the
> similar layers.
Don't forget that you'd have to run v.support after you've used v.patch
> This, obviously, is going to take loads of typing and time. Is there an
> easier way? Does anyone have a script which could automate any of this?
Right you are. This statement accurately sums up my experience. But put it in
perspective -- how many hours would it take for you to redigitize the same
> More related questions:
> 1) what will happen to the spot elevations layer after I run v.in.dxf? As
> mentioned previously, it contains both line (the spot) and label (the
> elevation number) info within the same layer. Will I lose the "spot"
> (line info) if I call this layer a label > layer or the "elevation #" if
> I call it a line?
You've got a problem here. Most CADD files have the text and the lines on
different levels. If you have everything on the same level it's going to
be somewhat of a mess. Guess you could run v.in.dxf twice and tell the program
the first time to stick the stuff in this level on the "lines" layer and the
second time to stick the stuff on the "labels" layer? Not sure. I'd have to
play around with various options.
Generally, I've used the spot elevations as site files -- assigning their label
as an attribute. Then you can convert the site file into a raster file and
patch it to the raster file that you get from converting the contour line
vector file to a raster file. The resulting patch of raster contour lines and
raster spot elevations can then be used to generate a digital terrain model.
> 2) has anyone else used v.cadlabel with success? It sure sounds like a huge
> timesaver compared with labelling all the contour lines in v.digit.
Yes. But you still have to do some editing in v.digit. The v.cadlabel program
only labels the contour lines that had text associated with them (i.e. the
index contour lines). You can then go in and finish labeling the lines using
the "contour lines/multiple lines" options in v.digit.
> Matt Knox (206)967-5337
More information about the grass-user