GRASS to ARC/INFO Conversion

stephan at alla.pl.swf.usace.army.mil stephan at alla.pl.swf.usace.army.mil
Thu Apr 18 08:00:00 EDT 1996


Dear Gregg:

I'm including my explination of how to get GRASS files
into Arc/Info at the end of this message.
This list of steps describes a polygon file transition, 
but it's similar if you want to get line attributes.

Most of this you've already done, but I'll include my entire step
by step proceedure so it will make sense.  Steps 2 and 3 
describe what needs to be done to the category file and
.txt file before importation into Arc Info.

If you have any questions, feel free to call me.  
We've done this many times, with great success.
My list of steps was written for my own use and I
may be leaving out steps that are intuitive to me.
So let me know if this works for you.

A few things to remember...
    1- ArcInfo will not recognize directories or filenames
        that contain capital letters.
    2- ArcInfo has trouble with files that begin with a number.
    3- Always use all capital letters when working in INFO.


I think there is an explination of the conversion on the GRASS 
FTP site as well, but I've never actually looked for it.

I hope you this will help you!

Good Luck!

Stephanie :)


*************************************************
     Stephanie L. Miller - Physical Scientist
     U.S. Army Corps of Engineers, Fort Worth
     CESWF-PL-RE
     819 Taylor Street
     P.O. Box 17300
     Fort Worth, Texas 76102-0300
 
     email: stephan at alla.pl.swf.usace.army.mil
     phone: (817)334-2095
     fax: (817)885-7539
***************************************************
     All comments are my own and do
     not represent official poilcy.
***************************************************



How to bring GRASS vector files into ARC/INFO and maintain polygon attributes..
.

1.  In GRASS use 
     v.out.arc type=polygon vect=<GRASS filename> arc_prefix=<arc filename>
     This command will produce 3 files in the "arc" directory of the 
     current mapset.
 
     <filename>.pol  = coordinate defintions of the lines defining the polygons
 
     <filename>.lab  = coordinates of the label points
     <filename>.txt  = a record # (arbitrary), category #, arc-id, 
                       and category name 

2.  For easy import into INFO, you must change the <filename>.txt file so 
     that only the arc-id, and category# remain.  The following awk statement 
     will do this and add a comma delimeter to the file.

          awk '{print $3 "," $2}' <filename>.txt > <filename>.txt2

     This will make a new file called <filename>.txt2 in the following format  
          arc-id,cat_num

3. To get the full category names you will need to copy the dig_cats file 
     to a new file (call it <newfilename>.txt3).  Delete the first 4 lines 
     of this file and change the delimeter to from ":" to ",".
        
         I find it easiest to use the text editor VI to do this step.
          open the file
             a. vi <newfilename>.txt3
          delete first 4 lines
             b. 4dd
          then change the ":" delimeter to a ","
             c. :g/:/s//,/g
          save and quit
             d.  ZZ
      

4.  In ARC use GENERATE to create an ARC/INFO coverage.
     generate <newfilename>
     Generate:  input <arc_prfix>.pol
     Generate:  lines
     Generate:  input <arc_prefix>.lab
     Generate:  points
     Generate:  q

5.  Create polygon topology using BUILD
     BUILD <newfilename> poly

6.  In INFO define 2 new files called <newfilename>.dat1 and <newfilename>.dat2
.  
     Then add the information from your ascii files into the new INFO files.

    a.    DEFINE <newfilename>.DAT1
          ITEM NAME> <newfilename>-id,4,5,B,0
          ITEM NAME> CATNUM,7,7,N,O

         Note: The item definition for the 
               <newfilename>-id must be exactly the same
               in all info files (4,5,B,0) in order to be 
               able to join them.

    b.    ADD FROM <filename>.TXT2 <ERRORFILE>.ERR

          Note:  You may need to give the full path 
                 to these files in order 
                 for INFO to find them.

    c.    DEFINE <NEWFILENAME>.DAT2
          ITEM NAME> CATNUM,7,7,N,0
          ITEM NAME> NAME,50,50,C

    d.    ADD FROM <filename>.TXT3 <ERRORFILE>.ERR

    e.    Q STOP will get you out of INFO.

7.  Join the new .dat files to the .pat file you created in step 4.

    a.    Join the category numbers to the  -ids...
          Joinitem <newfilename>.pat <newfilename>.dat1 <newfilename>.pat
          <newfilename>-id <newfilename>-id

    b.    Join the category names to the category numbers...
          Joinitem <newfilename>.pat <newfilename>.dat2 <newfilename>.pat CATNU
M
          CATNUM

8.  Build polygon topology a second time...
     build <newfilename> poly


9.  You will need to define the projection (if you want to keep a record of it)
    with the PROJECTDEFINE command in ARC.
  
    For example - if your GRASS file is in UTM projection, zone 13, the followi
ng
                  command will encode the appropriate information on the AI fil
e.

     a.  PROJECTDEFINE COVER <newfilename>
         Project: projection UTM
         Project: zone 11
         Project: units meters
         Project: spheroid clarke1866
         Project: parameters
 
        





More information about the grass-user mailing list