Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read MBTiles in paths containing multibytes #56023

Closed
2 tasks done
kohei-hasegawa opened this issue Jan 26, 2024 · 9 comments · Fixed by #56462
Closed
2 tasks done

Unable to read MBTiles in paths containing multibytes #56023

kohei-hasegawa opened this issue Jan 26, 2024 · 9 comments · Fixed by #56462
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Regression Something which used to work, but doesn't anymore WMS data provider

Comments

@kohei-hasegawa
Copy link

What is the bug or the crash?

Unavailable layer!
Layer data source could not be found.
Click to set a new data source

"テスト" in the layer or file name is Japanese and means test in English.

Error in Layer List
image

Repair Data Source screen
image

Steps to reproduce the issue

  1. Save any MBTiles file to a path containing multibytes
    example: "C:\OSGeo4W\テスト.mbtiles", "C:\OSGeo4W\テスト\test.mbtiles", "C:\OSGeo4W\テスト\テスト.mbtiles"
  2. Drag and drop MBTiles files into QGIS
  3. "Unavailable layer! Layer data source could not be found. Click to set a new data source" is displayed on the layer.

Versions

QGIS version
3.34.3-Prizren
QGIS code revision
4737323
Qt version
5.15.3
Python version
3.9.18
GDAL/OGR version
3.8.3
PROJ version
9.3.1
EPSG Registry database version
v10.098 (2023-11-24)
GEOS version
3.12.1-CAPI-1.18.1
SQLite version
3.41.1
PDAL version
2.6.0
PostgreSQL client version
15.2
SpatiaLite version
5.1.0
QWT version
6.1.6
QScintilla2 version
2.13.4
OS version
Windows 10 Version 2009

Active Python plugins
QuickOSM
2.2.3
db_manager
0.1.20
grassprovider
2.12.99
MetaSearch
0.3.6
processing
2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

To try out the new profile, I started QGIS in PowerShell with the following command
PS C:\OSGeo4W\bin> .\qgis-bin.exe --profile english --lang en-us

@kohei-hasegawa kohei-hasegawa added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 26, 2024
@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jan 28, 2024

@kohei-hasegawa thanks for reporting. Does the issue only occur trying to import an MBTiles layer file from a path containing Japanese characters or also trying to import any other layer file from a path containing Japanese characters?

@agiudiceandrea agiudiceandrea added the Data Provider Related to specific vector, raster or mesh data providers label Jan 28, 2024
@kohei-hasegawa
Copy link
Author

thanks for reporting. Does the issue only occur trying to import an MBTiles layer file from a path containing containing Japanese characters or also trying to import any other layer file from a path containing Japanese characters?

The same problem exists no matter which Japanese language is used.
This problem was reported on another website on March 18, 2022.
https://groups.google.com/g/qgisshitumon01/c/B9EWb0RCvvY

The 2022 report also occurred in "航空写真" and in Chinese characters meaning aerial photography in English.

As far as I know, the problem occurs when any of the Hiragana, Katakana, or Kanji characters commonly used in Japan are included.
Presumably, the same will occur in Chinese and Korean.

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jan 29, 2024

@kohei-hasegawa, does the issue only occur trying to import an MBTiles layer file or does it also occur trying to import any other layer file (e.g. ESRI Shapefile, or GeoPackage, or GeoTIFF, ...)?
Does the issue only occurs trying to import the layer via drag&drop or does it also occur using the Browser panel or the Data Source Manager?

@kohei-hasegawa
Copy link
Author

@kohei-hasegawa, does the issue only occur trying to import an MBTiles layer file or does it also occur trying to import any other layer file (e.g. ESRI Shapefile, or GeoPackage, or GeoTIFF, ...)? Does the issue only occurs trying to import the layer via drag&drop or does it also occur using the Browser panel or the Data Source Manager?

@agiudiceandrea
Thanks for gathering more information.

I have worked with Esri Shape files, GeoPackages, GeoJSON, GeoTIFF, and many other formats of data, but the problem occurs only with MBTiles.

The same problem occurs in the Browser panel and Data Source Manager.

The error displayed in Data Source Manager showed URI encoding.
Perhaps the encoding is causing the path to be unrecognizable.

Error Description
Invalid Data Source: type=mbtiles&url=C:%5CUsers%5Ckohei%5CDownloads%5C%E3%83%86%E3%82%B9%E3%83%88.mbtiles is not a valid or recognized data source, error: ""
image

Paths set in the UI
C:\Users\kohei\Downloads\テスト.mbtiles

I have attached the MBTiles used in this test.
The contents are the zoom levels 0-4 of the XYZ tiles published by the Geospatial Information Authority of Japan.
テスト.zip

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jan 29, 2024

@kohei-hasegawa, thanks for checking. Anyway the provided layer is not a "Vector Tile" layer, but it is a raster layer: please try if it is possible to add it using the Data Source Manager -> Raster tab.

It seems to me the issue only occurs importing the MBTiles layer file having name テスト.mbtiles via drag&drop or using the Browser panel, while it doesn't occur using the Data Source Manager -> Raster tab.

The issue occurs also with various characters other than Japanese or Chinese or Korean in the path: for example ŠŽšžŁČĚŐŰ i.e. characters after unicode U+00FF.

Additional notes:

  • when an MBTiles layer (either containing or non containing characters after unicode U+00FF in the path) is added to the project using Data Source Manager -> Raster, then the MBTiles layer is handled by the gdal provider and the issue doesn't occur;
    image

  • when an MBTiles layer (either containing or non containing characters after unicode U+00FF in the path) is added to the project via drag&drop or using the Browser panel, then the MBTiles layer is handled by the wms provider and

    • the issue occurs if the MBTiles layer's path contains characters after unicode U+00FF
      image

    • while it doesn't occur if the MBTiles layer's path doesn't contains characters after unicode U+00FF
      image

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jan 29, 2024

Testing some LTR versions, it looks like:

  • the issue doesn't occur using QGIS 3.10, since with such version the MBTiles layers are always handled by the gdal provider.

  • the issue partially doesn't occur using QGIS 3.16: if the MBTiles layer's path contains multi-bytes characters and it is imported via drag&drop or using the Browser panel, then the wms provider fails with the error Invalid Layer : WMS provider Cannot open MBTiles database Raster layer Provider is not valid (provider: wms, URI: type=mbtiles&url=file:///F:/QGIS/[...]/JAP/テスト.mbtiles and then the MBTiles layer is automatically handled by the gdal provider and imported as gdal raster layer.

  • the issue occurs using QGIS 3.22 and next versions QGIS 3.28, QGIS 3.34.

@agiudiceandrea agiudiceandrea added the Regression Something which used to work, but doesn't anymore label Jan 29, 2024
@agiudiceandrea
Copy link
Contributor

Hi @wonder-sk, have you seen this issue report about MBTiles raster layers in paths containing multibytes that are not correctly handled by the WMS provider?

@kohei-hasegawa
Copy link
Author

@agiudiceandrea

Thanks for your help.
I added the layer as a raster as instructed and it loaded correctly.

Please correct me if I am wrong in my perception.

Do you need any additional information from me?

@nirvn
Copy link
Contributor

nirvn commented Feb 21, 2024

@kohei-hasegawa , thanks for the report, this was a rather serious limitation/issue I'm glad we could address. The fix should make its way to the next public release (end of February).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Regression Something which used to work, but doesn't anymore WMS data provider
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants