We have also had success with views. There are a few queries to run to
register them correctly. You can do this via the QGIS Database manager. DB
Browser for SQLite is also good. Note that the view must include an integer ID
to render correctly in some settings.
CREATE VIEW IF NOT EXISTS "view_locality_geology" AS
SELECT
loc.fid as fid,
loc.name as name,
loc.rock_type,
geo.minerals as colour,
geo.age as age,
loc.geometry as geometry
FROM locality as loc
LEFT JOIN geological_units geo on geo.rock_type= rock_type;
INSERT INTO gpkg_contents
VALUES('view_locality_geology,'features','view_locality_geology','View with
geology information at locality
positions','2023-09-15T13:21:52.679Z',NULL,NULL,NULL,NULL,4326);
INSERT INTO gpkg_geometry_columns
VALUES('view_locality_geometry','geometry','POINT',4326,1,0);
From: QGIS-User <[email protected]> On Behalf Of Mike Bundock
via QGIS-User
Sent: 17 October 2025 20:28
To: Simon Dietmann <[email protected]>
Cc: qgis-user <[email protected]>
Subject: Re: [Qgis-user] save a join between attribute and table in gpkg?
hi
we had a similar issue in that we could not find a way of saving join
information. The technique we ended up using was to extend the qml syntax to
support join field definitions, and use a small function to re-establish joins
correctly. This is really useful if the same sets of tables are used in
multiple projects. Its simply a matter of loading the qml files using the
layer -> properties -> load style function.
We also use it as an easy method to define the join fields within other
applications such as Augview. It means that UI behaviour within multiple
applications is consistent and only needs defining once.
hope that is helpful. If you want to use the same syntax, let me know & i will
send some documentation.
regards
Mike Bundock | CEO
Augview | P O Box 125046, St Heliers, Auckland 1740, New Zealand
p: +64 9 575 5298 | m: +64 27 575 5298 | e: mailto:[email protected]| w:
www.augview.net<http://www.augview.net>
[Image removed by sender.] [Image removed by sender.] [Image removed
by sender.]
Winner of Innovation & Commercialisation and Supreme Awards at 2014 NZ Spatial
Excellence Awards
Winner of Innovation & Commercialisation Award at 2014 Asia Pacific Spatial
Excellence Awards
On Fri, 17 Oct 2025, 11:13 pm Simon Dietmann via QGIS-User,
<[email protected]<mailto:[email protected]>> wrote:
Dear list,
I am trying to export some feature classes inside a common gpkg that have
attribute joins to a table that’s also stored in the same gpkg. Afaics there
is no possibility to store the information about the table join also inside the
gpkg, is that correct?
Is there a way to store (and share) the joins except sharing a .qgz file?
Thanks for your advice,
Regards
Simon
i.A. Simon Dietmann
Projektleiter | Geograph
[cid:[email protected]]
PGNU Planungsgesellschaft Natur & Umwelt mbH
Amtsgericht Frankfurt am Main, HRB 111938;
Geschäftsführer: Dr. Benjamin Hill, Dorit Thurm, Sebastian Braun
Hamburger Allee 45 +++ 60486 Frankfurt am
Main<https://www.google.com/maps/search/Hamburger+Allee+45+%2B%2B%2B+60486+Frankfurt+am+Main?entry=gmail&source=g>
Durchwahl: +49 69 952964-32 +++ Fax: +49 69 952964-99
E-Mail: [email protected]<mailto:[email protected]> +++ Web:
www.pgnu.de<http://www.pgnu.de>
> Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte Informationen
> enthalten. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
> Weitergabe dieser Mail sind nicht gestattet.
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error) please
> notify the sender immediately and destroy this e-mail. Any unauthorised
> copying, disclosure or distribution of the material in this e-mail is
> strictly forbidden.
_______________________________________________
QGIS-User mailing list
[email protected]<mailto:[email protected]>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
This email and any attachments are intended solely for the use of the named
recipients. If you are not the intended recipient you must not use, disclose,
copy or distribute this email or any of its attachments and should notify the
sender immediately and delete this email from your system. UK Research and
Innovation (UKRI) has taken every reasonable precaution to minimise risk of
this email or any attachments containing viruses or malware but the recipient
should carry out its own virus and malware checks before opening the
attachments. UKRI does not accept any liability for any losses or damages which
the recipient may sustain due to presence of any viruses.
_______________________________________________
QGIS-User mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user