[GRASS5] v.out.ogr question

Hi,

I used the module v.out.ogr in GRASS5.7 to export polygons but missed
the parameter 'type=area'. The result was a warning:

WARNING: Requested types: points and lines, but (additionally) areas found.
         Check 'type' parameter.
3426 features written
WARNING: 3426 features without category written

but the map was also exported with lines instead of areas. I don't
understand why the module explains a mistake but still exports
the data. Wouldn't it make more sense to simply stop after warning,
so the user has to add/modify the missing parameter?

  Otto

On Fri, Mar 12, 2004 at 05:58:40PM +0100, Otto Dassau wrote:

Hi,

I used the module v.out.ogr in GRASS5.7 to export polygons but missed
the parameter 'type=area'. The result was a warning:

> WARNING: Requested types: points and lines, but (additionally) areas found.
> Check 'type' parameter.
> 3426 features written
> WARNING: 3426 features without category written

but the map was also exported with lines instead of areas. I don't
understand why the module explains a mistake but still exports
the data. Wouldn't it make more sense to simply stop after warning,
so the user has to add/modify the missing parameter?

Otto,

I have made a test with a map containing a single area:

v.info ammprv | grep Number
| Number of points: 0 Number of areas: 1 |
| Number of lines: 0 Number of islands: 1 |
| Number of boundaries: 1 Number of faces: 0 |
| Number of centroids: 1 Number of kernels: 0 |
| Number of dblinks: 1 |

GRASS 5.7.-cvs:~/test > v.out.ogr ammprv dsn=ammprv layer=ammprv
WARNING: Requested types: points and lines, but (additionally) areas found.
         Check 'type' parameter.
1 features written
WARNING: 1 features without category written

-> Strange: I would expect 0 features written.

Markus

On Wednesday 17 March 2004 18:23, Markus Neteler wrote:

On Fri, Mar 12, 2004 at 05:58:40PM +0100, Otto Dassau wrote:
> Hi,
>
> I used the module v.out.ogr in GRASS5.7 to export polygons but missed
>
> the parameter 'type=area'. The result was a warning:
> > WARNING: Requested types: points and lines, but (additionally) areas
> > found. Check 'type' parameter.
> > 3426 features written
> > WARNING: 3426 features without category written
>
> but the map was also exported with lines instead of areas. I don't
> understand why the module explains a mistake but still exports
> the data. Wouldn't it make more sense to simply stop after warning,
> so the user has to add/modify the missing parameter?

Otto,

I have made a test with a map containing a single area:

v.info ammprv | grep Number

| Number of points: 0 Number of areas: 1 |
| Number of lines: 0 Number of islands: 1 |
| Number of boundaries: 1 Number of faces: 0 |
| Number of centroids: 1 Number of kernels: 0 |
| Number of dblinks: 1 |

GRASS 5.7.-cvs:~/test > v.out.ogr ammprv dsn=ammprv layer=ammprv
WARNING: Requested types: points and lines, but (additionally) areas found.
         Check 'type' parameter.
1 features written
WARNING: 1 features without category written

-> Strange: I would expect 0 features written.

Why strange? Requested type is 'line,boundary' (default) and there is 1 boundary
in ammprv and that boundary is exported.

Radim

Radim Blazek schrieb:

On Wednesday 17 March 2004 18:23, Markus Neteler wrote:
> On Fri, Mar 12, 2004 at 05:58:40PM +0100, Otto Dassau wrote:
> > Hi,
> >
> > I used the module v.out.ogr in GRASS5.7 to export polygons but missed
> >
> > the parameter 'type=area'. The result was a warning:
> > > WARNING: Requested types: points and lines, but (additionally) areas
> > > found. Check 'type' parameter.
> > > 3426 features written
> > > WARNING: 3426 features without category written
> >
> > but the map was also exported with lines instead of areas. I don't
> > understand why the module explains a mistake but still exports
> > the data. Wouldn't it make more sense to simply stop after warning,
> > so the user has to add/modify the missing parameter?
>
> Otto,
>
> I have made a test with a map containing a single area:
>
> v.info ammprv | grep Number
>
> | Number of points: 0 Number of areas: 1 |
> | Number of lines: 0 Number of islands: 1 |
> | Number of boundaries: 1 Number of faces: 0 |
> | Number of centroids: 1 Number of kernels: 0 |
> | Number of dblinks: 1 |
>
> GRASS 5.7.-cvs:~/test > v.out.ogr ammprv dsn=ammprv layer=ammprv
> WARNING: Requested types: points and lines, but (additionally) areas found.
> Check 'type' parameter.
> 1 features written
> WARNING: 1 features without category written
>
> -> Strange: I would expect 0 features written.

Why strange? Requested type is 'line,boundary' (default) and there is 1 boundary
in ammprv and that boundary is exported.

Hi Radim,

I simply think it would be nice, if v.out.ogr doesn't export any data,
as long as
the parameter 'type' is not set correctly. This would just make sure,
that the user
really gets what he intends. I know it is not an error, more a whish and
maybe also
too petty.

  Otto

On Thu, Mar 18, 2004 at 10:59:53AM +0100, Otto Dassau wrote:

Radim Blazek schrieb:
>
> On Wednesday 17 March 2004 18:23, Markus Neteler wrote:
> > On Fri, Mar 12, 2004 at 05:58:40PM +0100, Otto Dassau wrote:
> > > Hi,
> > >
> > > I used the module v.out.ogr in GRASS5.7 to export polygons but missed
> > >
> > > the parameter 'type=area'. The result was a warning:
> > > > WARNING: Requested types: points and lines, but (additionally) areas
> > > > found. Check 'type' parameter.
> > > > 3426 features written
> > > > WARNING: 3426 features without category written
> > >
> > > but the map was also exported with lines instead of areas. I don't
> > > understand why the module explains a mistake but still exports
> > > the data. Wouldn't it make more sense to simply stop after warning,
> > > so the user has to add/modify the missing parameter?
> >
> > Otto,
> >
> > I have made a test with a map containing a single area:
> >
> > v.info ammprv | grep Number
> >
> > | Number of points: 0 Number of areas: 1 |
> > | Number of lines: 0 Number of islands: 1 |
> > | Number of boundaries: 1 Number of faces: 0 |
> > | Number of centroids: 1 Number of kernels: 0 |
> > | Number of dblinks: 1 |
> >
> > GRASS 5.7.-cvs:~/test > v.out.ogr ammprv dsn=ammprv layer=ammprv
> > WARNING: Requested types: points and lines, but (additionally) areas found.
> > Check 'type' parameter.
> > 1 features written
> > WARNING: 1 features without category written
> >
> > -> Strange: I would expect 0 features written.
>
> Why strange? Requested type is 'line,boundary' (default) and there is 1 boundary
> in ammprv and that boundary is exported.

Hi Radim,

I simply think it would be nice, if v.out.ogr doesn't export any data,
as long as
the parameter 'type' is not set correctly. This would just make sure,
that the user
really gets what he intends. I know it is not an error, more a whish and
maybe also too petty.

I have modified v.out.ogr messages to catch all cases. Now it always
prints a message if vector types are present but not requested for
export.

Examples:

#---------------- export of Lines map with wrong type parameter:
v.out.ogr viapri dsn=viapri layer=viapri type=area
WARNING: 2003 Line(s) found, but not requested to be exported. Verify
         'type' parameter.
0 features written

#---------------- export of Lines map with default settings:
v.out.ogr viapri dsn=ammprv layer=viapri
2003 features written

#---------------- export of Points map with wrong type parameter:
v.out.ogr coords_cea dsn=ammprv layer=coords_cea
WARNING: 18 Point(s) found, but not requested to be exported. Verify 'type'
         parameter.
0 features written

#---------------- export of Points map with correct type parameter:
v.out.ogr coords_cea dsn=ammprv layer=coords_cea type=point
18 features written

Hope it's better now. Suggestions after testing welcome.

Markus

On Thursday 18 March 2004 10:59, Otto Dassau wrote:

> > | Number of points: 0 Number of areas: 1
> > | | Number of lines: 0 Number of islands: 1
> > | | Number of boundaries: 1 Number of faces: 0
> > | | Number of centroids: 1 Number of kernels: 0
> > | | Number of dblinks: 1
> > | |
> >
> > GRASS 5.7.-cvs:~/test > v.out.ogr ammprv dsn=ammprv layer=ammprv
> > WARNING: Requested types: points and lines, but (additionally) areas
> > found. Check 'type' parameter.
> > 1 features written
> > WARNING: 1 features without category written
> >
> > -> Strange: I would expect 0 features written.
>
> Why strange? Requested type is 'line,boundary' (default) and there is 1
> boundary in ammprv and that boundary is exported.

Hi Radim,

I simply think it would be nice, if v.out.ogr doesn't export any data,
as long as the parameter 'type' is not set correctly. This would just make sure,
that the user really gets what he intends. I know it is not an error, more a whish and
maybe also too petty.

This particular case is not important, but this issue in general is very important.
One of very few advantages of GRASS over proprietary competitors is that it does what
user requested specifying parameters and it does not do what maybe could be
intendet result of majority of users.
With GRASS, I am sure that I can do what I want, and I cannot, for example,
end up with with impossibility to export boundaries as lines to shape only
because users mostly exports areas and they don't read option descriptions.

Back to the case above. How can the module recognize that you don't want
boundaries and you have done a mistake?

Two examples when what v.out.ogr does in this case is correct:
1) transfer data to another topological GIS, that means we want boundaries
   as lines, not closed polygons
2) 1000 vectors in GRASS, not all of them contains all possible features,
   if those vectors are exported (srcipt), even if no requested feature is present,
   correct and desired output is empty file, not missing file.

Radim

Radim Blazek schrieb:

On Thursday 18 March 2004 10:59, Otto Dassau wrote:
> > > | Number of points: 0 Number of areas: 1
> > > | | Number of lines: 0 Number of islands: 1
> > > | | Number of boundaries: 1 Number of faces: 0
> > > | | Number of centroids: 1 Number of kernels: 0
> > > | | Number of dblinks: 1
> > > | |
> > >
> > > GRASS 5.7.-cvs:~/test > v.out.ogr ammprv dsn=ammprv layer=ammprv
> > > WARNING: Requested types: points and lines, but (additionally) areas
> > > found. Check 'type' parameter.
> > > 1 features written
> > > WARNING: 1 features without category written
> > >
> > > -> Strange: I would expect 0 features written.
> >
> > Why strange? Requested type is 'line,boundary' (default) and there is 1
> > boundary in ammprv and that boundary is exported.
>
> Hi Radim,
>
> I simply think it would be nice, if v.out.ogr doesn't export any data,
> as long as the parameter 'type' is not set correctly. This would just make sure,
> that the user really gets what he intends. I know it is not an error, more a whish and
> maybe also too petty.

This particular case is not important, but this issue in general is very important.
One of very few advantages of GRASS over proprietary competitors is that it does what
user requested specifying parameters and it does not do what maybe could be
intendet result of majority of users.
With GRASS, I am sure that I can do what I want, and I cannot, for example,
end up with with impossibility to export boundaries as lines to shape only
because users mostly exports areas and they don't read option descriptions.

Back to the case above. How can the module recognize that you don't want
boundaries and you have done a mistake?

Two examples when what v.out.ogr does in this case is correct:
1) transfer data to another topological GIS, that means we want boundaries
   as lines, not closed polygons
2) 1000 vectors in GRASS, not all of them contains all possible features,
   if those vectors are exported (srcipt), even if no requested feature is present,
   correct and desired output is empty file, not missing file.

I think it is important, that people have to set the parameter type=' '
and
think about what they do. To me following modification would be useful.
Nothing happens
except a WARNING without the 'type' parameter, and if it is used, but
with the wrong type as in markus example:

export of Lines map with wrong type parameter:
v.out.ogr viapri dsn=viapri layer=viapri type=area
WARNING: 2003 Line(s) found, but not requested to be exported. Verify
         'type' parameter.
0 features written

then it might be better to write a WARNING, but export the data, because
the
the user probably chose this type on purpose.

Maybe this makes sense?

    Otto