[GRASSLIST:1475] A different problem with v.in.mif

  I'm really puzzled about this. In the project directory, I placed a
MapInfo .mif/.mid pair of files to add to the data already there. I can view
raster, vector and sites data in the directory with 5.0beta11.2. However,
each time I run v.in.mif, I'm told that the .mif file doesn't exist.

  According to the man page, v.in.mif looks for the .mif file in the current
directory. That's where it is. I also tried it with the source files in the
dig/ directory, but that made no difference. Permissions on the source files
are 666.

  Any ideas?

Thanks,

Rich

Dr. Richard B. Shepard, President

                       Applied Ecosystem Services, Inc. (TM)
              Making environmentally-responsible mining happen. (SM)
                       --------------------------------
            2404 SW 22nd Street | Troutdale, OR 97060-1247 | U.S.A.
+ 1 503-667-4517 (voice) | + 1 503-667-8863 (fax) | rshepard@appl-ecosys.com

On Tue, Feb 20, 2001 at 05:12:48PM -0800, Rich Shepard wrote:

  I'm really puzzled about this. In the project directory, I placed a
MapInfo .mif/.mid pair of files to add to the data already there. I can view
raster, vector and sites data in the directory with 5.0beta11.2. However,
each time I run v.in.mif, I'm told that the .mif file doesn't exist.

  According to the man page, v.in.mif looks for the .mif file in the current
directory. That's where it is. I also tried it with the source files in the
dig/ directory, but that made no difference. Permissions on the source files
are 666.

  Any ideas?

Nope. I tried you files. Same result. Among the things I noticed: No
category file seems to be written, the program just exits silently if
you don't specify a log file. For this particular file, there seems to
be alot of misplaced area attribute markers (not unusual with these darn
non-topological spatial graphics files...) -- apparently a few islands
too.

This is a very new module, so I'm sure David will be working on it
more... The conversion of these graphics type files to arc-node is hard
to do well, while the reverse is easier.

--
Eric G. Miller <egm2@jps.net>

On Tue, 20 Feb 2001, Eric G. Miller wrote:

Nope. I tried you files. Same result.

  Phew! It's not just me. Good. :slight_smile:

Among the things I noticed: No category file seems to be written, the
program just exits silently if you don't specify a log file. For this
particular file, there seems to be alot of misplaced area attribute
markers (not unusual with these darn non-topological spatial graphics
files...) -- apparently a few islands too.

  I'll take a look again at the original. These data come from a prospective
client and I need to get them into GRASS as a "proof of concept" that GRASS
is the platform for their environmental decision support system. Therefore,
it's rather important to me.

  The data were in terrible shape when I got them. That's why there are now
5 separate files for this one theme: I kept removing overlaps into separate
files. However, ... come to think of it ... there were three pairs of
identical objects with completely different attribute records. I'll look
into that today.

  There should be no islands there; objects can be adjacent (with a common
boundary), but each is a discrete rectangle. It could be that the lack of
category file is caused by two attribute records for a single spatial area.

  I will say that this is the worst-formed data I've dealt with in many
years. So, I'll work more with it in MapInfo and see if I can find the
problems there. Based on what you found, I suspect that that's where the
problems lie.

This is a very new module, so I'm sure David will be working on it
more... The conversion of these graphics type files to arc-node is hard
to do well, while the reverse is easier.

  I know full well. That's why David did all the heavy lifting on this. And
I am grateful for his efforts. If we can discover what makes the module fail
in a translation we can be more explicit about the condition of the data
before translation.

  I'll also try another file from this set: the Public Land Survey System
grid (Township, Range, Section). That _should_ be a lot cleaner.

Thanks,

Rich

Dr. Richard B. Shepard, President

                       Applied Ecosystem Services, Inc. (TM)
              Making environmentally-responsible mining happen. (SM)
                       --------------------------------
            2404 SW 22nd Street | Troutdale, OR 97060-1247 | U.S.A.
+ 1 503-667-4517 (voice) | + 1 503-667-8863 (fax) | rshepard@appl-ecosys.com

"Eric G. Miller" wrote:

On Tue, Feb 20, 2001 at 05:12:48PM -0800, Rich Shepard wrote:
> I'm really puzzled about this. In the project directory, I placed a
> MapInfo .mif/.mid pair of files to add to the data already there. I can view
> raster, vector and sites data in the directory with 5.0beta11.2. However,
> each time I run v.in.mif, I'm told that the .mif file doesn't exist.
>
> According to the man page, v.in.mif looks for the .mif file in the current
> directory. That's where it is. I also tried it with the source files in the
> dig/ directory, but that made no difference. Permissions on the source files
> are 666.
>
> Any ideas?

Nope. I tried you files. Same result. Among the things I noticed: No
category file seems to be written, the program just exits silently if
you don't specify a log file. For this particular file, there seems to
be alot of misplaced area attribute markers (not unusual with these darn
non-topological spatial graphics files...) -- apparently a few islands
too.

This is a very new module, so I'm sure David will be working on it
more... The conversion of these graphics type files to arc-node is hard
to do well, while the reverse is easier.

Hi Eric, Rich,

Pardon my tardy entry into this discussion - I have been away most of
the last couple of days.

It seems v.in.mif has a lot of bugs. There are some petty errors to do
with parsing the input directory and storing some paramater data.
Because these can be worked around, I considered these to be of lower
priority than the kinds that can corrupt data. The module attempts to
simulate the structure of a `shape' in a shapefile by building a series
of rings associated with a given region. It then attempts to distinguish
between hulls and holes by checking the circulation, and what rings are
contained in what - so one `region' could contain disjoint polygons,
each with its own disjoint set of holes [am I right in thinking that
Rich ?]. Then it calls GRASS's inbuilt vector function for determining a
centroid.

This is a place where a standard re-usable R-tree structure would be
useful.

I thought from my experience with shapefiles that it is better to work
out the topological parameters from the data that is there rather than
relying on what the import map says (boundary data is often bizarre).
Also - a point I don't understand: if a region can consist of disjoint
sets, why only allow one centroid record per region, and if so, what
does it mean?

The state of the module was one of the reasons I had commented it out in
the first place, in fact I did that when I started to develop the code
for line-splitting, as that broke the module completely for a while. It
now compiles and runs, but clearly is not very usable yet. I will look
through the code this weekend and try and sort some of the more annoying
minor bugs. For now, I will change the code to use the map's value of
the centroid instead of the calculated one. That will elliminate the
need for the ring topolgy code - which I am _certain_ is the main source
of the bugs. Oh - there is the snapping problem, which affects both
v.in.shape and v.in.mif on large scale maps eg. lat/lon., but I think
I've tracked down what is causing that and it will be fixed first.

Hopefully we can get this stuff working - at last - soon.

Regards

David

On Wed, 21 Feb 2001, David D Gray wrote:

Pardon my tardy entry into this discussion - I have been away most of
the last couple of days.

David,

  Always better late than never. :slight_smile:

It seems v.in.mif has a lot of bugs. There are some petty errors to do
with parsing the input directory and storing some paramater data.
Because these can be worked around, I considered these to be of lower
priority than the kinds that can corrupt data. The module attempts to
simulate the structure of a `shape' in a shapefile by building a series
of rings associated with a given region. It then attempts to distinguish
between hulls and holes by checking the circulation, and what rings are
contained in what - so one `region' could contain disjoint polygons,
each with its own disjoint set of holes [am I right in thinking that
Rich ?]. Then it calls GRASS's inbuilt vector function for determining a
centroid.

  I'm not at all familiar with shapefiles, other than getting data in that
format. If I understand what you've written (and that's a very big "if"),
the answer is "generally, no".

  MapInfo calls their closed objects "regions". A region/polygon can have
holes in it. For example, a table of lakes in a county (or larger rivers)
could have islands in the lakes/rivers. Sometimes, folks just leave the lake
region whole (entire) and place the island region(s) on top of it for
display purposes. Other folks (and I'm in this category) "erase" the island
from the lake polygon so the area calculation is true and there's only one
ground type at any given point. What this babbling means is that usually
regions/polygons are distinct. They can share a common border, but MI
doesn't build or store topology so the common border has two identical
lines; one is part of each region/polygon object.

  I've no idea of what the rings are supposed to do. I'm trying to build a
mental picture, but I'm not sure that I'm doing it properly. I also have no
idea what algorithms are used to take arc-node lines and build topology from
them. That was my stumbling block a while ago.

  Now that I'm fully committed to working exclusively with GRASS, I do need
to get my MI data over. Especially the data I've sent you this past week for
those are client data and they need to see that GRASS can work for them.
They don't have MI, that's just the way they were given the data. They tried
using it with ARC/cad (the AutoCAD add-on), but the overlapping regions
killed them, too.

  I'll start reading the code this evening. If I follow with my finger and I
move my lips, too, I'll probably be able to understand what you're doing. We
can take this discussion off the list, too, and work together on making
v.in.mif work.

  I'm also having major problems with v.in.shape on the data translated from
MI. It just won't work. But, we can discuss this privately, too.

This is a place where a standard re-usable R-tree structure would be
useful.

  References for me to read and learn?

I thought from my experience with shapefiles that it is better to work
out the topological parameters from the data that is there rather than
relying on what the import map says (boundary data is often bizarre).
Also - a point I don't understand: if a region can consist of disjoint
sets, why only allow one centroid record per region, and if so, what
does it mean?

  In the case of MI, a region/polygon with holes, the centroid is the center
of mass of the entire region. So, it may well be located in a hole. Is this
what you mean?

Hopefully we can get this stuff working - at last - soon.

  We will. There are a lot of GRASS users with MI data out here.

Rich

Dr. Richard B. Shepard, President

                       Applied Ecosystem Services, Inc. (TM)
              Making environmentally-responsible mining happen. (SM)
                       --------------------------------
            2404 SW 22nd Street | Troutdale, OR 97060-1247 | U.S.A.
+ 1 503-667-4517 (voice) | + 1 503-667-8863 (fax) | rshepard@appl-ecosys.com