Bug 248718 - graphics/qgis gpkg is not a valid or recognized data source
Summary: graphics/qgis gpkg is not a valid or recognized data source
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-18 08:21 UTC by Nezos
Modified: 2022-09-28 08:56 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (rhurlin)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nezos 2020-08-18 08:21:40 UTC
Overview
--------
QGIS refuses to connect to a geopackage.

Steps to Reproduce
------------------
Open QGIS, Add Layer, Select something and then choose on the left Geopackage.
Add a geopackage and hit connect.

Actual results
--------------
QGIS Log Messages:
CRITICAL    Error opening layer : Error opening file, check file and directory permissions on /mydir/myfile.gpkg

As the permissions are correct for the files and the folders, I executed it from the terminal as user and as root.

When executing from terminal as a user or as root:
ERROR 4: '/mydir/myfile.gpkg' not recognized as a supported file format.

Build Date & Hardware
---------------------
QGIS version 3.14.0-Pi
QGIS code branch Release 3.14
Compiled against Qt 5.14.2
Running against Qt  5.14.2
Compiled against GDAL/OGR 3.1.0
Running against GDAL/OGR  3.1.0
Compiled against GEOS 3.8.1-CAPI-1.13.3
Running against GEOS  3.8.1-CAPI-1.13.3
Compiled against SQLite 3.32.2
Running against SQLite  3.32.2
PostgreSQL Client Version 11.8
SpatiaLite Version 4.3.0
QWT Version 6.1.4
QScintilla2 Version 2.11.4
Compiled against PROJ 6.3.1
Running against PROJ Rel. 6.3.1, February 10th, 2020
OS Version FreeBSD 12.1-RELEASE-p7
Active python plugins HCMGIS; MetaSearch; db_manager; processing
Comment 1 Rainer Hurling freebsd_committer freebsd_triage 2020-08-18 10:03:19 UTC
(In reply to Nezos from comment #0)

Hi Nezos, Thanks for the report.

Unfortunately, I do not fully understand, what you did in detail. If I am right, you at first loaded something like a vector layer into QGIS.

In your next step, I have problems to understand, what is meant by "... and then choose on the left Geopackage". Do you mean to select Geopackage within the QGIS 'Browser' window? And what exactly happens after hitting connect, did you choose one of 'New Connection' or 'Create Database'? ...


If your main purpose is to connect to a given Geopackage database, than it is not needed to add a layer before.

The error message, especially the second one from your terminal session, indicates that there IS a problem with permissions. What is myfile.gpkg, a Geopackage once created from QGIS?

BTW, how to 'execute' /mydir/myfile.gpkg?
Comment 2 Nezos 2020-08-18 11:10:44 UTC
(In reply to Rainer Hurling from comment #1)

Sorry, I will clarify. Just to note that I installed the LTR version and I still get the same errors.

"If I am right, you at first loaded something like a vector layer into QGIS."

Yes, I tried to load a vector layer from a geopackage. And I get invalid data source.

"In your next step, I have problems to understand, what is meant by "... and then choose on the left Geopackage". Do you mean to select Geopackage within the QGIS 'Browser' window? And what exactly happens after hitting connect, did you choose one of 'New Connection' or 'Create Database'? ... 
If your main purpose is to connect to a given Geopackage database, than it is not needed to add a layer before."

Then alternatively I tried to connect to the existing geopackage database. I tried different files that were created in the past from QGIS.

"The error message, especially the second one from your terminal session, indicates that there IS a problem with permissions. What is myfile.gpkg, a Geopackage once created from QGIS?"

There are no permission problems inside the folder. I think this is rather misleading as I can read and write other files. Unless another component requires permissions (?) - that would be strange though.

"BTW, how to 'execute' /mydir/myfile.gpkg?"

I don't execute this. It's just a dummy location of the file.

Moreover, I tried to load a KML file and get again the same error:
CRITICAL    Invalid Data Source : /home/user/Desktop/points.kml is not a valid or recognized data source.

I hope the above help.
Comment 3 Rainer Hurling freebsd_committer freebsd_triage 2020-08-18 11:22:18 UTC
(In reply to Nezos from comment #2)

Hmm, not clear to me what happens here. Perhaps it is best to get it step by step.

Could you please, in the terminal, show me the output of

ogrinfo /home/user/Desktop/points.kml
ogrinfo /home/user/Desktop/myfile.gpkg

and than for both files the output of 'ls -l'?


And, are you able to load simple (ESRI) shapefiles from the same directory(!) via 

  Layer -> Add Layer -> Add Vector Layer
Comment 4 Nezos 2020-08-18 11:33:43 UTC
(In reply to Rainer Hurling from comment #3)

% ogrinfo /home/user/Desktop/points.kml

FAILURE:
Unable to open datasource `gravity_relative_points.kml' with the following drivers.
  -> PCIDSK
  -> PDS4
  -> VICAR
  -> JPEG2000
  -> PDF
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> OGR_SDTS
  -> S57
  -> DGN
  -> OGR_VRT
  -> REC
  -> Memory
  -> BNA
  -> CSV
  -> GML
  -> GPX
  -> KML
  -> GeoJSON
  -> GeoJSONSeq
  -> ESRIJSON
  -> TopoJSON
  -> OGR_GMT
  -> WAsP
  -> OpenFileGDB
  -> XPlane
  -> DXF
  -> CAD
  -> FlatGeobuf
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> PGDUMP
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> OGR_PDS
  -> HTF
  -> AeronavFAA
  -> EDIGEO
  -> SVG
  -> Idrisi
  -> ARCGEN
  -> SEGUKOOA
  -> SEGY
  -> SXF
  -> Selafin
  -> JML
  -> VDV
  -> MVT
  -> MapML
  -> TIGER
  -> AVCBin
  -> AVCE00

=====================================================
ogrinfo /home/user/Desktop/myfile.gpkg

FAILURE:
Unable to open datasource `AreaLimits.gpkg' with the following drivers.
  -> PCIDSK
  -> PDS4
  -> VICAR
  -> JPEG2000
  -> PDF
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> OGR_SDTS
  -> S57
  -> DGN
  -> OGR_VRT
  -> REC
  -> Memory
  -> BNA
  -> CSV
  -> GML
  -> GPX
  -> KML
  -> GeoJSON
  -> GeoJSONSeq
  -> ESRIJSON
  -> TopoJSON
  -> OGR_GMT
  -> WAsP
  -> OpenFileGDB
  -> XPlane
  -> DXF
  -> CAD
  -> FlatGeobuf
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> PGDUMP
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> OGR_PDS
  -> HTF
  -> AeronavFAA
  -> EDIGEO
  -> SVG
  -> Idrisi
  -> ARCGEN
  -> SEGUKOOA
  -> SEGY
  -> SXF
  -> Selafin
  -> JML
  -> VDV
  -> MVT
  -> MapML
  -> TIGER
  -> AVCBin
  -> AVCE00

=====================================================

"are you able to load simple (ESRI) shapefiles from the same directory(!)"

Yes, from the same directory.
Comment 5 Rainer Hurling freebsd_committer freebsd_triage 2020-08-18 11:52:27 UTC
(In reply to Nezos from comment #4)

OK, many thanks. For me, this sounds like a problem with GDAL, not QGIS. QGIS is able to load .shp files, but not .kml or .gpkg.

Most likely, your graphics/gdal port was built without options SQLITE and KML enabled. Could you please try to build and install graphics/gdal with both options set, then repeat the ogrinfo command (see comment #3) and report back?
Comment 6 Nezos 2020-08-18 11:58:28 UTC
(In reply to Rainer Hurling from comment #5)

Yes, you are right, it's a GDAL problem.

I haven't built myself anything. I installed everyting from ports using:

pkg install qgis

or 

pkg install qgis-ltr

I checked : https://www.freshports.org/graphics/gdal

and it seems that gdal was built without the flags you mentioned, strange though as someone dealing with geodata would definitely use KML and sqlite based databases. Should I file a bug request for gdal for a differnt build?

As I just moved to FreeBSD I am not yet ready to build the ports myself.

Thank you for your time.
Comment 7 Nezos 2020-08-18 12:02:01 UTC
I found this bug submission which pertains to my problem: 

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224004
Comment 8 Rainer Hurling freebsd_committer freebsd_triage 2020-08-18 12:28:16 UTC
(In reply to Nezos from comment #6 and comment #7)

Nice to hear, that we could isolate the problem. It is a long outstanding problem with the options of graphics/gdal and the needs of other ports, which depend on them.

Loïc Bartoletti already investigated much in getting it smoother. The GDAL port is maintained by sunpoet and he also is aware of the problem. Changing default settings of ports, on which many other ports depend, could have side effects and can cause heavy regressions. So this needs some more time to change the default setting here, I think.

If you want to give it a try by your own. It is not to heavy to build and install a port after setting the wanted options. You can find more info in the FreeBSD Handbook[1], especially from chapter 4.6 on. In general, there are several different possibilities to get your on set of configuration for ports. If you decide to do it 'manually' only for graphics/gdal, only a few steps are needed:

  cd /usr/ports/graphics/gdal
  make clean
  make config  [set your wanted options]
  make build
  make deinstall  [get rid of the installation by 'pkg']
  make install
  
But please, take a deeper look in the mentioned section of the handbook before start this, thanks.

HTH and good luck.

[1] https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports.html
Comment 9 sasuke2690 2022-09-14 07:05:00 UTC
MARKED AS SPAM
Comment 10 OlaShannon 2022-09-28 08:56:26 UTC
MARKED AS SPAM