Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#829 closed defect (invalid)

v.in.ogr: when pointing to a folder import of vectors can produce wrong results

Reported by: lutra Owned by: grass-dev@…
Priority: major Milestone: 6.4.0
Component: Vector Version: 6.4.0 RCs
Keywords: v.in.ogr Cc:
CPU: x86-32 Platform: All

Description

I was giving a try to v.in.ogr pointing to a folder containing a few shapfiles and the results didn't convinced me. So I made a simple test.

*) Created two simple shapefiles each containing one polygon, each polygon partially overlapping the one in the other shape *) Placed the shapes in one folder and run "v.in.ogr -o dsn=/home/gio/test_shapes output=test_import"

The expected result was to obtain two layers each with one feature, as in the original shapes.

Instead I get 3 layers:

*) One with one feature, representing the overlap area *) Two representing the original polygons except for the fact they are made of two features: the "extra" feature is the overlap area

Seems wrong to me, considering that if the poligons in the sample shapes do not overlap, then the results are the expected ones.

Change History (6)

comment:1 Changed 10 years ago by mmetz

Resolution: invalid
Status: newclosed

The overlap area becomes a separate area because a topological vector format like in grass does not allow overlapping areas. You can try to preserve the original areas with

v.in.ogr -c

(don't apply topological cleaning to areas), but may need to manually place centroids of overlapping areas in a non-overlapping part of the area; this is supported in grass and will give you a vector without errors. Shapefiles are not topological, i.e. there is no connection whatsoever between two polygons, be they separate, adjacent or overlapping. Some other (proprietary) GIS applications with native topological vectors don't even allow partially overlapping areas like grass does.

In short, the results you got are the expected ones and the ticket is invalid, but I hope I could clarify nevertheless why grass behaves the way it does. Some more info is in the vector intro part of the manual.

Markus M

comment:2 Changed 10 years ago by pcav

I think most users would expect a different behaviour from this command, importing all the shp in a folder as different GRASS vectors. It would be good to make this unexpected behaviour clear from the description of the command (also in the QGIS plugin)

comment:3 in reply to:  2 ; Changed 10 years ago by mmetz

Replying to pcav:

I think most users would expect a different behaviour from this command, importing all the shp in a folder as different GRASS vectors. It would be good to make this unexpected behaviour clear from the description of the command (also in the QGIS plugin)

Right, the manual was not clear, I updated the description in grass64, develbranch and trunk (r39972, r39973, r39974 respectively).

Importing all shapefiles in a folder as different grass vectors can be done in the wxGUI with

File -> Import vector map -> Multiple vector data import using OGR

comment:4 in reply to:  3 ; Changed 10 years ago by lutra

Importing all shapefiles in a folder as different grass vectors can be done in the wxGUI with

File -> Import vector map -> Multiple vector data import using OGR

is this made trough a python script?

comment:5 in reply to:  4 ; Changed 10 years ago by mmetz

Replying to lutra:

Importing all shapefiles in a folder as different grass vectors can be done in the wxGUI with

File -> Import vector map -> Multiple vector data import using OGR

is this made trough a python script?

It's written in python, but not as a single script, it is embedded into the wxGUI and only available when using the wxGUI.

comment:6 in reply to:  5 Changed 10 years ago by lutra

It's written in python, but not as a single script, it is embedded into the wxGUI and only available when using the wxGUI.

too bad, I was thinking to use it to create a script for the qgis GRASS plugin

Note: See TracTickets for help on using tickets.