OSGeo / grass

GRASS GIS - free and open-source geospatial processing engine
https://grass.osgeo.org
Other
852 stars 309 forks source link

[Bug] Multiple vector import does not work #1885

Open madi opened 3 years ago

madi commented 3 years ago

From the GRASS 8 GUI,

File - Import vector data - Simplified import with reprojection [v.import]

and

File - Import vector data - Import of common vector formats [v.in.ogr]

For both, the multiple import does not work. It is only possible to import one file at a time, if you select Source type:directory the list of the layers is not loaded.

veroandreo commented 3 years ago

I tried and it works just fine for me with a folder full of shp files... You have to select the format yourself though, AFAIK they are not automatically read. Did you try that? Does it happen with all formats?

image

I use grass main compiled a couple of days ago:

GRASS version: 8.0.dev                                                          
Code revision: 75dd60a69                                                        
Build date: 2021-09-19                                                          
Build platform: x86_64-pc-linux-gnu                                             
GDAL: 3.2.2                                                                     
PROJ: 7.2.1                                                                     
GEOS: 3.9.0                                                                     
SQLite: 3.34.1                                                                  
Python: 3.9.7                                                                   
wxPython: 4.0.7                                                                 
Platform: Linux-5.13.16-200.fc34.x86_64-x86_64-with-glibc2.33
madi commented 3 years ago

Hi Vero, thanks for checking. I verified and with shp works.

Screenshot from 2021-09-23 08-29-42

It doesn't seem to work with Geopackage.

Screenshot from 2021-09-23 08-27-33

veroandreo commented 3 years ago

It works here also with geopackage... no idea

image

tmszi commented 3 years ago

I confirm this issue. According my debug info Import vector data wxGUI dialog internally use v.external command for list of available layers including feature type in data source.

https://github.com/OSGeo/grass/blob/fb4a9754ba0f658dd877123d5071dbe1d233b6d0/gui/wxpython/gui_core/gselect.py#L2239-L2241

If I manually run v.external command (/tmp dir contains two GeoPackage files) I get error message:

GRASS nc_basic_spm_grass7/PERMANENT:~ > v.external -t input=/tmp/
ERROR: Unable to open data source '/tmp/'

My GeoPackage files are vector maps exported by GRASS GIS.

v.external command internally use OGR API for get list of available layers including feature type in data source.

https://github.com/OSGeo/grass/blob/fb4a9754ba0f658dd877123d5071dbe1d233b6d0/vector/v.external/list.c#L258-L260

It seems these GeoPackages isn't supported (get list of available layers including feature type in data source if data source is directory of GeoPackage files) by OGR GeoPackage driver .

GRASS GIS libs info:

GRASS 8.0.dev (2021)
PROJ: 7.2.1
GDAL/OGR: 3.2.2
GEOS: 3.9.1
SQLite: 3.35.5
veroandreo commented 3 years ago

True! I checked again and the files recognized above are indeed Shp files, even if I selected Geopackage. This is odd...

v.external -t /home/veroandreo/Documents/conae/time_series_clust/dengue_2020_cba/
Data source
</home/veroandreo/Documents/conae/time_series_clust/dengue_2020_cba/>
(format 'ESRI Shapefile') contains 3 layers:
barrios,polygon,0,
barrios_populares,3dpolygon,0,
Autoctonos_19_20_posgar,point,0,
veroandreo commented 3 years ago

kml is not recognized either... only ESRI shapefiles.

And it affects 7.8 as well

tmszi commented 3 years ago

kml is not recognized either... only ESRI shapefiles.

Yes of course, because not all OGR format driver support get list of available layers including feature type in data source if data source is directory (ESRI Shapefile driver supports it).

e.g.

GRASS nc_basic_spm_grass7/PERMANENT:~ > v.external -t input=/tmp/elev_pts.gpkg 
Data source </tmp/elev_pts.gpkg> (format 'GPKG') contains 1 layer:
elev_pts,point,1,geom