v.in.arc

Craig A. Miller cmiller at pnwg.wa.com
Thu Nov 25 22:28:21 EST 1993


On Fri, 26 Nov 1993, J.M. Ruiz wrote:

> --------------------------
> v.in.arc
> --------------------------
> 
> Hallo,
> 
> I am a recent GRASSuser. In our work in Hydrology we have to convert ARC/INFO 
> files (watersheds) to GRASS. We are running v.in.arc command with these 
> parameters:
> 
> type = polygon
> 
> lines_in = created with UNGENERATE command (ARC/INFO) with option LINE
> 
> points_in = created with UNGENERATE command with option POINT
> 
> text_in = created with UNLOAD command in TABLES (ARC/INFO), which saves a ASCII file containing selected records and items (watersheds categories).
> 
> But the output of v.in.arc (a vector file in GRASS format) does not contain the categories in areas.
> 
> Could anybody help me?. Would it be possible to label automatically these areas
> in GRASS vector file with categories of these areas in ARC/INFO after running 
> v.in.arc?
> 
> 
> -------------------------------------------------
> Juan M. Ruiz
> Centro de Estudios Hidrograficos (CEDEX)
> Paseo Bajo de la Virgen del Puerto 3, planta 3
> 28005 Madrid, SPAIN
> 
> Telephone: 335.79.51
> Fax: 335.79.22
> e-mail: jruiz at gea.cedex.es
> -------------------------------------------------


JM,

I have included a document that I put together (mostly for my own use) that
covers exporting Arc/Info data.  I have exported Arc data dozens of time
this way and it has eventually worked each time.  Unfortunately, it is
not always as simple as moving a MS Word file into Wordperfect.  :-)
I hope it helps.  If you have any trouble let me know and I will do my
best to help.  Good Luck.

Document follows:
---------------------------------8<----------------cut here-----------------

IMPORTING DATA:  ARC/INFO to GRASS 4.0

AUTHOR:  Craig A. Miller
DATE:    July 19, 1993

Importing Data from Arc/Info GIS into GRASS GIS is a two phase procedure.

PHASE 1 - Exporting from Arc/Info

1.  Identify the Arc coverage that you wish to export.
                o Before doing anything, copy the coverage to your Arc Info
                  workspace, and do your work on the duplicated coverage.

                  You can do this by using the Arc command "copy <incovername>
                  <outcovername>.  Be sure to use complete paths for both
                  the incover and the outcover parameters.

                For Example:
                w /usr/rivers
                copy /usr/rivers/wenatchee /usr/craig/water/wenatchee
                w /usr/craig/water

        Use the Arc command "DESCRIBE <CoverageName>" to answer the following:

        a.  Has it been projected to the coordinate system you are using
            (ie. Clarke66 and UTM's - At least in our case.)

        YES - Then move on to question b.
        NO - Then use the Arc command project to project the coverage
correctly.

                o To do this you may need to know both the current projection
                  information as well as what you want to project it too.


                For Example:

                w /usr/craig/water
                project cover <wenatchee> <wenatchee.out>
                input
                projection utm
                units meters
                zone 9
                parameters
                output
                projection utm
                units meters
                zone 10
                parameters
                end




  b.  Is it a polygon coverage

            NO  - Move on to step c.
            YES - Then use the Arc command "ungenerate" once with the
lines 
                  option, and once with the point option.
        USAGE:  From the ARC prompt.  
                ungenerate <line | point> <incover> <outcover>

            ie.   ungenerate line wenatchee.out wenatchee.lin
                  ungenerate point wenatchee.out wenatchee.lab

        NOTE:  It is common to use .lin to signify a line coverage, and
.lab to
        signify the point coverage.  This is because they will be used as
        the input into grass as the line file and label file.   

        c.  Is it a line coverage?
            
             No  - I am sorry, if it is neither a line file or a polygon file
                   then you will not be able to export it.  I have yet to 
                   figure out how to export a point file (Although I do have
                   an idea, I just haven't tried it yet.  :)

             YES - Then use the Arc command ungenerate line.
             
             ie.  ungenerate line wenatchee.out wenatchee.lin


3. From the arc prompt type - info
4. Turn your 'caps lock' ON.
5. enter ARC as your user name.
6. type - "select <covername.pat> if it is a polygon coverage.
                                 or
                  "select <covername.aat> if it is a line coverage.
7. type items
8. Choose the columns of data that will reflect each of the
        following and write down the name of the item:

        ITEM1           a.  point or line id's - usually covername-id
        ITEM2           b.  Grass category values.  Must be an integer
                            value.  Cannot contain commas. You may have
                            to edit this file with a text editor before
                            it will import correctly into GRASS (Don't 
                            worry about this now though).
        ITEM3           c.  Grass attribute text. This cannot contain
                            any spaces, so you may have to edit this
                            column of data before bringing it into GRASS
                            too (Don't worry about this now though).  
                 
9.  type - "OUTPUT <COVENAME.TXT> INIT "
10.  type - "DISPLAY 5T,ITEM1,15T,ITEM2,25T,ITEM3"
11.  type - "Q STOP"
12.  take your caps lock off
13.  type - "&sys"
14.  type - "cd info"
15.  type - "ls | more"
16.  You should see a file called <covername.txt>.
17.  Move this file to where the "Ungenerate" files from the
    previous steps are being stored for export by using the UNIX
    command "mv fromfile tofile"
    If you followed the instructions in this document, they should be
    in your arc workspace which is one directory up from where you
    are now.  Therefore, if you type 
                mv <covername.txt> ../<covername.txt> you should
    be ok.
18.  You should now edit out any commas in the 2nd column of
    covername.txt and any spaces in the third column of covername.txt.
    I have noticed that many times the first row of data is missing
    values in the covername.txt file because it represents the
    Arc universe polygon.  You will need to fill in those columns 
    with data such as  0      0     NODATA.

19.  You can now export your datafiles to tape, disk, or 
     if GRASS is running on the same machine as Arc/Info you
    can copy the files (covername.lin, covername.lab, covername.txt)
    to $mapset/arc


PHASE 2.  THE GRASS SIDE OF THINGS.........


Use v.import as describe in the grass users manual to bring the data 
  across.  If you are having difficulty, check to see that you have 
  cleaned the data up as described in step 18 of exporting from Arc.

------------------------------------8<---------------Cut-Here-----------------


Craig A. Miller
Pacific Northwest Geographics
Voice: (509) 662 4479
E-mail: cmiller at pnwg.wa.com








More information about the grass-user mailing list