importing Arcview shape files

David D Gray ddgray at armadce.demon.co.uk
Thu Jul 27 13:08:04 EDT 2000


Hi Andy,


Andy Bernat wrote:
> 
> Greetings,
> I'm having trouble importing shape files, using Grass 5 beta 7 on a SuSE
> 6.3 system.  Running v.in.shape gives me a segmentation fault.  I
> remember seeing some exchanges on an improved version of v.in.shape that
> resides in the CVS tree.  However, I looked for it and couldn't find it
> (probably because I know nothing about CVS!).  Would someone be so kind
> as to (a) tell me how to get the new v.in.shape and (b) what to do with
> it
> once I get it.
> 

There is information on how to obtain the GRASS tree, or parts of it, at

http://freegis.org/grass

by public anonymous access.

The new version is of course also available with the newly released Beta
8. I still regard this module as alpha software, because although it is
now very useful, for many shapefile examples, you probably have noticed
that shapefiles are *very* prone to topological corruption, and we have
had to learn as we go along how to import, convert and fix various
problems. That's an ongoing business.

I'm very interested to know of any problems, like segfaults, but the
more information about the problem the better. One thing is that this
module is currently excessively memory intensive, and runs out of memory
far too soon. With 128MB RAM + 4 swap devices @ 128MB each, you won't be
able to import files above 10,000 polygons on average. Systems with
fewer resources will be more limited. A segmentation process is being
developed to allow import of arbitrarily large shapefiles. If your files
are this large, for now, can you split them into smaller pieces?

> Also, in the hope that I'd have better luck importing an ascii file than
> I
> had with the shape file, I exported the shape file from Arcview using a
> shp2gen script, which created a simple ascii file with a .gen
> extension. 

This won't work, or at any rate produce generally usable GRASS vector
maps. The `shapegen' format is not the same as the Arc/Info format of
the same name that GRASS can read, and this is what ArcView creates.
There is a script lying around somewhere (I don't know if it's in the
current tree - or even in GRASS 5) called v.in.arc.poly that converts
these shapegen files to the three components of the `proper' ungen
files, but even here you have to hack the Avenue script to make it print
the label points out on the same lines as the ring numbers:

111 200000.000000 600000.000000
[vertice list starts here]


I used to have a script that does this but I've long since lost it.

> However, when I tried to import it using v.import, grass
> couldn't find it.  I tried putting it in all the subdirectories that
> seemed
> to make sense but Grass never found it.  Perhaps I need a specific
> extension,
> that isn't .gen? 

If you use v.in.arc.poly, the input is just one file, or also a text
file with info content, the .gen should be OK.

> So, if I could impose on the list for even more
> advice, where does
> one put files to import so Grass can find them? 

v.in.shape can import from a file location in the current directory, or
from a full filepath spec, there's no special location. `Proper' ungen
files go in $MAPSET/arc



David




More information about the grass-user mailing list