Translating file formats

David D Gray ddgray at armadce.demon.co.uk
Thu May 18 15:27:20 EDT 2000


Rich Shepard wrote:
> 
> 
>   I understand the concept of starting at a node, walking the intermediate
> points until another node is reached, and so on. But, I don't understand how
> to do this in practice.

You have to build a database (of some kind) to hold all the vertices, in
the
form of references to structures that store information about their
position, links and maybe other information. This is keyed by position.
You traverse the database sequentially, identifying nodes and deal with
each
in turn. Pull out all the tracks, and mark non-nodal tracks `deleted' as
you go. Never follow a track if it consists of `deleted' points - it's
already done. A second pass of the database now deals with the remaining
non-nodal points. For each one, follow one of its tracks till you get
back
to the original point, blanking all the intermediates as you go. Each
track
is just  a sequence of references to the vertex structures. To get them
into
GRASS you have to replace each track sequence by two arrays holding the
sequence of x and y co-ordinates respectively. The functions
Vect_copy_xy_to_pnts
and Vect_write_line are then used to commit the arcs to the dig file.

> 
>   I just exported a MapInfo polygon file: counties in the state of Nevada.
> There are only 16 counties so the file is relatively small. The attributes
> for each polygon is the county name, county number and state number. The
> attributes are held in the *.mid fil, the graphics in the *.mif file. There
> is a one-to-one correspondence by order. That is, the fist graphic unit is
> associated with the first attribute, and so on.
> 

Ah! So it is much like a shapefile. The import mechanisms will probably
be
very similar - also similar problems.

>   Rather than attach both files and send them to everyone on the mail list,
> I'd rather work with those more knowledgable and experienced than I off the
> list. I can explain each element in the .mid and .mif files. What I really
> want to learn is how to parse these objects into the arc-node format of
> GRASS and how to then build the topology.
> 
>   I'd also appreciate pointers to references where I can learn more about
> the storage of spatial topology. I understand quad trees (although it's been
> almost a decade since I did any reading on them).

Yes. I would echo this. Especially it would be good to have online
references

David




More information about the grass-user mailing list