inasafe / inasafe

InaSAFE - QGIS plugin for estimating impact from natural disasters
www.inasafe.org
GNU General Public License v3.0
259 stars 136 forks source link

We should support keywords in geopackage datastore #3244

Open Gustry opened 7 years ago

Gustry commented 7 years ago

Problem

We should support keywords in the datastore for read and write with the monkey patching.

For now we have only two datastores :

We will add soon :

timlinux commented 6 years ago

Lets wait for QGIS 3 metadata in datasource support

Gustry commented 6 years ago

I just started a prototype in the PR above.

mbernasocchi commented 6 years ago

hi @timlinux I encoutered a bug related to this. When you load two different layers from the same geopackage they will share the keywords. screenshot from 2018-07-05 10-40-23 screenshot from 2018-07-05 10-40-12

Are you guys still working on @Gustry's PR #4921 ?

Gustry commented 6 years ago

You have this bug because InaSAFE doesn't care about what is after the | in your layer path unfortunately. https://github.com/inasafe/inasafe/blame/master/safe/metadata/base_metadata.py#L196

So I guess you have a XML file sitting next to your geopackage. (one XML keywords file for one geopackage with many layers inside!)

Maybe it would be better to store keywords in the inasafe metadata DB?

BTW, is there not a kind of bug from QGIS? On the source text of your point layer, I would expect to have the layername property. How InaSAFE can know which layer it is in the geopackage? I already noticed this behavior.

mbernasocchi commented 6 years ago

BTW, is there not a kind of bug from QGIS? On the source text of your point layer, I would expect to have the layername property. How InaSAFE can know which layer it is in the geopackage? I already noticed this behavior.

yes, I think this happens when you load a GPKG that has only one layer. after adding multiple layers probably it just picks the first layer. @nyalldawson is it a bug or a feature? :)

nyalldawson commented 6 years ago

@mbernasocchi I'm a bit lost sorry, can you summarise exactly what the issue is?

mbernasocchi commented 6 years ago

when you two issues here the first is the one this bug report is about (keywords being per gpkg file and not per layer) but it is not the one I'm asking you about.

the second (The QGIS Question risen by @Gustry) is that when you add a GPKG with only one layer it is loaded as /path/file.gpkg when you add a further layer to this file it is loaded as: /path/file.gpkg|layername=SecondLayer which is the behaviour I'd expect in every case also when adding a GPKG that has only one layer

nyalldawson commented 6 years ago

@mbernasocchi

Seems like a bug to me too