SUMMARY: Arc/Info to GRASS conversions - comp.infosystems.gis #10629

Darrell McCauley mccauley at ecn.purdue.edu
Sun Aug 29 22:55:12 EDT 1993


[I thought that it would be good if this information made it into the
 GRASSHopper archives, hence the post --jdm]

In article <9308271544.AA12719 at vcgi.uvm.edu>, Steve Bower <steveb at VCGI.UVM.EDU> writes:
|> SUMMARY: Arc/Info -> GRASS data conversions.
|> 
|> NOTE: The original question went out on GIS-L and ESRI-L, thus so does the
|>   response.  Sorry for the cross-posting, they're identical.
|> 
|> ORIGINAL QUESTION:
|> 
|> We are an Arc/Info shop, but would like to distribute data in a format for
|> conversion to GRASS.  All I know (from one source) is that I should
|> provide the data in DLG format with no transformation.  I've read ARCDLG,
|> so I know that attributes are a pain: that is, I believe I will have to
|> convert my attribute tables to MAJOR/MINOR pairs, or generate an ACODE
|> file.
|> 
|> Does anyone have any automated programs or other custom software for this
|> conversion?  Any tricks of the trade and known pitfalls would be
|> appreciated.  A summary will be posted - thanks in advance.
|> 
|> Steve Bower, Vermont Center for Geographic Information, 802-656-4277.
|> 
|> #####################################################> Next response:
|> 
|> Return-Path: cg at cast.uark.edu
|> 
|> I've done some data conversion between Arc/Info and GRASS.
|> I wrote a step by step process, and hope you find it helpful.
|> 
|> ================================================================
|> 
|> TOPIC:  Convert a polygon coverage from Arc/Info to GRASS
|> 
|> Use a coverage named 'school' as an example to show the procedure:
|> 
|> STEP 1.   --- Get data out of Arc/Info
|> 1.1  get line data
|> Arc: ungenerate line school school.lin
|> 
|> 1.2  get label point data
|> Arc: ungenerate point school school.lab
|> 
|> 1.3  get label text (attribute) data from INFO
|>  ENTER COMMAND >OUTPUT ../school.txt
|> 
|>  ENTER COMMAND >SELECT SCHOOL.PAT
|>       12 RECORD(S) SELECTED
|> 
|>  ENTER COMMAND >LIST PRINT                  (See Note2)
|> 
|>  ENTER COMMAND >Q STOP
|> 
|>  school.txt should look like this:
|>  $RECNO           AREA    PERIMETER SCHOOL# SCHOOL-ID SCHOOL-NAME
|>       1   -2.46815E+09  216,729.700     1       0
|>       2   3.871248E+08  121,106.100     2       5     Springdale
|>       3   2.923594E+08  114,518.100     3      11     Fayetteville
|>       4   2.754085E+08  144,500.300     4       6     Prairie Grove (See Note1)
|>       5   83192210.000   54,980.120     5       7     Farmington
|>       6   98547120.000   53,769.720     6       4     Siloam Springs
|>       7   3.852254E+08  112,999.100     7       3     Lincoln
|>       8   2.611844E+08  101,406.700     8       1     Elkins
|>       9   1.898218E+08  112,633.000     9       8     Greenland
|>      10   2.734009E+08  101,322.400    10       9     West Fork
|>      11   1.676338E+08   66,904.990    11       2     Winslow
|>      12   54256160.000   32,175.590    12      10     West Fork
|> 
|> 
|> STEP 2.   --- Bring data into GRASS
|> 2.1  create a subdirectory called 'arc' in your current mapset if necessary and
|>      copy school.lin school.lab school.txt to the 'arc' directory
|> 
|> GRASS 4.1beta >  v.in.arc type=polygon lines_in=school.lin points_in=school.lab
|>  text_in=school.txt vector_out=sch_dist idcol=5 catcol=5 attcol=6
|> 
|> GRASS 4.1beta > v.support map=sch_dist
|> 
|> Note1: If the attribute text contains blank, (for example, Prairie Grove), the
|>        second word is dropped after running 'v.in.arc'.  My only suggestion
|>        is to edit the dig_cats file so that the complete attributes can be
|>        retained.
|> 
|> Note2: If the PAT file contains a lot of columns, you have to use the INFO
|>        command - REPORT to create a report which looks like the above
|>        example(school.txt).  For more information about REPORT refer to
|>        INFO Reference Manual.
|> 
|> #####################################################> Next response:
|> 
|> Return-Path: fsbo/S=H.SHOVIC/OU=R01F11A at mhs.attmail.com
|> 
|> OK, here is our procedure.  This uses GRASS 4.0 (MASSCOMP) and ARC
|> 6.1.1 (DEC).  UNGEN LINES to get *.LIN file.  Do not use POLY option.
|> UNGEN POINT to get *.LAB file.   Then go to INFO,
|> OUTPUT *.TXT
|> SEL *.PAT of the coverage of interest
|> DISP list of variables you want in GRASS (see manual)  PRINT
|>            This creates and writes to the *.TXT file.
|> Then go to GRASS to import.
|> Henry SHovic
|> 
|> #####################################################> Next response:
|> 
|> Return-Path: camann at pick.uga.edu
|> 
|> I have done a number of A/I to GRASS conversions.  The basic technique
|> is:
|> 
|> 1) UNGENERATE the ARC coverage.  Coverages that will end up as GRASS
|> vector files need only lines, e.g. UNGENERATE lines <your_coverage>.
|> Those that contain polygons and are destined to become raster layers
|> need lines and points, eg:
|> 
|> UNGENERATE lines <your_coverage> <lines_output_filename>
|> UNGENERATE points <your_coverage> <points_output_filename>
|> 
|> Next, use DISPLAY or PRINT (I think-- this is from memory) from within
|> INFO to print out the fields you need from the database.
|> 
|> 2) Move all of the ungenerated files and the database text files to
|> $LOCATION/arc-- you'll probably have to create the arc directory
|> yourself.  The files MUST be in this directory.  $LOCATION is defined
|> by GRASS at startup, so if you mv them from within a GRASS session,
|> they'll go to the right place.
|> 
|> 3) Use v.in.arc to suck the files into GRASS.  The g.manual entry
|> explains things pretty well.  This is probably where problems will
|> occur if any occur at all.  This program is touchy about the format of
|> the ungenerated file.
|> 
|> 4) Run v.support on the resulting file.  Be sure to use the <build>
|> option.  In my experience, v.support generates tons of error messages,
|> but few of these are ever significant, so don't let them throw you.
|> 
|> 5) Run v.digit on the v.support output.  At a minimum, run v.digit with
|> no digitizer (mouse mode), fill in the information regarding scale,
|> window boundaries, etc, then let v.digit draw the file.  When it
|> finishes, you can either save the resulting vector layer as is or
|> modify it.  If it is destined for raster-hood, you should probably
|> check and make sure that all polygons are closed-- see the v.digit
|> tutorial for additional details if you need them.
|> 
|> 6) If you want to build raster coverages, run v.to.rast on the vector
|> layer after v.digit.  As I recall, v.to.rast creates a HUGE temporary
|> file, so be sure you have lots of disk space available.
|> 
|> 7) Run r.support to assign a color table, check category labels, etc.
|> Voila-- you're done!
|> 
|> Good luck-- let me know if I can be of any further assistance.
|> 
|> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|> 
|> Michael Camann                          camann at dial.pick.uga.edu
|> Department of Entomology                camann at athena.cs.uga.edu
|> University of Georgia                   (706) 542-1388
|> Athens, GA 30602                        (706) 542-2276
|> 
|> #####################################################> Next response:
|> 
|> Return-Path: gislist at crdokokl.cr.usgs.GOV
|> 
|> I recently sent some coverages to someone using GRASS, and he wanted them
|> in UNGEN format.  That is a very simple ASCII-file format for line and
|> point coords.  You can add an ASCII attribute file, as well.  I haven't
|> heard back from the fellow after the last attempt (it has taken 2 or 3),
|> but that time he faxed me the GRASS manual pages, and I think we got it
|> in a form he could use.  Following are some notes I made so I could keep
|> track of how this was done:
|> 
|> How to export a polygon coverage to GRASS GIS:    ahrea  8/2/93
|> 
|> In order to provide geology coverages to J.D. (Mike Smolen's grad
|> student at OSU), I had to experiment a couple of times to get a
|> transferable format.  The GRASS 4.0 command v.in.arc can read
|> ungenerate files.  For a polygon coverage, it needs 3 files: lines,
|> label points, and attributes.  The attribute file needs to contain the
|> following items: cover-id; an integer category number; optional category
|> descriptive text.  To create a category number, I used frequency to add
|> the CASE# item to the coverage pat.  (The help file for frequency is wrong,
|> it does NOT automatically add the CASE# item to the in_file.)  I then used
|> the TABLES unload command to output the files to ascii.
|> 
|> Here is an example:
|> 
|> Enter Command: unload
|> Usage: UNLOAD <out_file> {item...item} {DELIMITED | COLUMNAR <format_file>}
|>               {INIT}
|> 
|> Enter Command: unload /var/ftp/pub/gis_data/woodward.txt woodward-id case# ~
|> Enter Command: stunit columnar /var/ftp/pub/gis_data/woodward.txt.fmt init
|> Unloading data to /var/ftp/pub/gis_data/woodward.txt.
|> Unloading format to /var/ftp/pub/gis_data/woodward.txt.fmt.
|> 
|> Enter Command: q stop
|> 
|> The only drawback to this method is the columnar option doesn't insert any
|> space between columns.  I'll let J.D. deal with that if it's a problems for
|> GRASS.  Hopefully, this should do it.
|> 
|> I hope this helps.
|> --
|> Alan Rea, Hydrologist         *    ahrea at csdokokl.cr.usgs.gov (USE THIS ONE!)
|> U.S. Geological Survey        * "None are more hopelessly enslaved than those
|> Oklahoma City, Oklahoma, USA  *  who falsely believe they are free" -- Goethe
|> Any opinions are my own, and do not represent those of my employer...
|> 
|> #####################################################> Next response:
|> 
|> Return-Path: westk at BCC.ORST.EDU
|> 
|> Probably the easiest way to do it is to output the features from A/I with the
|> "ungenerate lines" command.  Place the files it produces in your $LOCATION/arc
|> directory and use v.in.arc to convert them.  The arc directory doesn't exist
|> by default you will have to create it.  Read the man pages for v.in.arc for
|> the specifics.
|> 
|> Hope this helps!
|> 
|> ken
|> --
|> =-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=
|> Kenneth J. West           The word "set" has more meanings than any other word
|> westk at ava.bcc.orst.edu    in the English language, 128 noun, 56 verb, 10 adj.
|> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|> 
|> #####################################################> Next response:
|> 
|> Since GRASS is a Raster tool, primarily, and ARC (GRID) will generate GRASS
|> output ... have you considered that route?  You should retain the attributes
|> then - the flip would be in converting ARC vector data into GRIDs before
|> making the raster ... Is this an option? (Assumes also workstation ARC, rather
|> than pc, and 6.1 onwards, of course ...)
|> 
|> Peter Halls
|> University of York
|> PJH1 at UK.AC.YORK   - or t'other way about
|> 
|> #####################################################> Next response:
|> 
|> Return-Path: malcolm at cast.uark.edu
|> 
|> Steve,
|> GRASS has an import module specifically for dealing with ARC files. It works
|> well, but there are a couple minor details. The GRASS  command v.in.arc requires
|> input files in the ARC UNGENERATE format. The line and attribute files work
|> straight from UNGENERATE, but the label files have to be manually produced from
|> INFO (at least, that's how we do it). If the lines in ARC were double-precision,
|> they have to be fixed so that GRASS can read them. I use the following shell-
|> script:
|> 
|> -------------------
|> #!/bin/sh
|> 
|> #          *** arc2grass.lines ***
|> 
|> # Written by Malcolm Williamson
|> 
|> # This program will fix ARC ungenerated double-precision line files
|> # so that they are readable by GRASS v.in.arc program.
|> # File names will have to be changed.
|> 
|> awk '{ if ($1 == "END") {
|>            print $0
|>        }
|>        else
|>      if ( NF == 3 ) {
|>            $2 = substr($2,3,6) "." substr($2,9,9)
|>            $3 = substr($3,3,7) "." substr($3,10,8)
|>            print "         " $1 "       " $2 "       " $3
|>        }
|>         else {
|>            $1 = substr($1,3,6) "." substr($1,9,9)
|>                 $2 = substr($2,3,7) "." substr($2,10,8)
|>            print "       " $1 "       " $2
|>        }
|>  }' inputfile > outputfile
|> exit 0
|> -----------------------
|> 
|> I have include the GRASS manual page for v.in.arc. I recommend you look at it
|> carefully. I can answer more questions for you later, but I need to run right
|> now.
|> -------------
|> 
|> 
|> v.in.arc <alpha>     GRASS Reference Manual      <alpha> v.in.arc

[man page deleted]

|> Malcolm D. Williamson - Research Assistant       E-mail: malcolm at cast.uark.edu
|> Center for Advanced Spatial Technologies      Telephone: (501) 575-6159
|> Ozark Rm. 12                                        Fax: (501) 575-3846
|> University of Arkansas
|> Fayetteville, AR 72701

-- 
James Darrell McCauley            Dept of Ag Engineering, Purdue Univ
internet: mccauley at ecn.purdue.edu West Lafayette, Indiana 47907-1146, USA
bitnet: mccauley%ecn at purccvm      UUCP: pur-ee!mccauley



More information about the grass-user mailing list