<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Johannes,</p>
<p>The issue is exactly that you checked <span lang="EN-US">"Don't
resolve type of unrestricted columns (GEOMETRY)". If you uncheck
it, the content of GEOMETRY columns will be scanned and you'll
get one layer per found geometry type.</span></p>
<p><span lang="EN-US">Even<br>
</span></p>
<div class="moz-cite-prefix">Le 28/11/2022 à 14:39, Johannes
Echterhoff via Qgis-user a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:GV1P193MB2232228AF96A00CAE6B565BCFC139@GV1P193MB2232.EURP193.PROD.OUTLOOK.COM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}span.E-MailFormatvorlage17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi all,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">This topic may have come
up before, in which case I apologize up-front. I just want
to make sure that I am not missing anything.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">My question is about the
behavior in QGIS for a database table, let's call it
"ft_geometry", with a single, general geometry column
(geometry type is GEOMETRY), compared to the behavior of a
table "ft_multi" which has multiple columns with a specific
geometry type (for example, one column with MULTIPOINT and
one with MULTILINESTRING). When I connect to such a database
- e.g., a PostgreSQL one - and open it in the project
browser, then ft_geometry is not shown at all, while
ft_multi is shown as many times as there are columns with
specific geometry type.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">QGIS allows adding
ft_geometry manually, thereby choosing a specific geometry
type for editing, via the Data Source Manager and via the DB
Manager. I'll explain that using an example database schema
and QGIS screenshots in more detail below, just for
reference. However, what I am wondering is: Is it possible
to somehow achieve, that, when opening the database in the
project browser, ft_geometry is also shown with a list of
specific geometry types (e.g., point and line)? Is there
maybe a configuration option where one could set the desired
specific geometry types, to be used in such a scenario, or a
plugin? I've scanned the list of available plugins in QGIS
3.28.0, without success - but I may very well have missed
something there. The background of why I'd like to have a
certain list of specific geometry types is that in my use
case, objects represented by tables like ft_geometry always
have the same list of specific geometry types - and there
can be many such tables in the database, which is why I am
searching for a way to avoid manually adding such tables
(each as many times as the specific geometry types that are
needed).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Any help or guidance
would be very appreciated.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Johannes<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">P.S.: Here is the
database schema as well as QGIS screenshots<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">------<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">CREATE EXTENSION
postgis;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">CREATE TABLE ft_geometry
(<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> _id bigserial NOT
NULL PRIMARY KEY,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> name text, <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> position
geometry(GEOMETRY,25832)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">CREATE TABLE ft_multi (<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> _id bigserial NOT
NULL PRIMARY KEY,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> name text, <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> position_point
geometry(MULTIPOINT,25832),<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> position_line
geometry(MULTILINESTRING,25832),<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> position_polygon
geometry(MULTIPOLYGON,25832)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">CREATE INDEX
idx_ft_geometry_position ON ft_geometry USING GIST
(position);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">CREATE INDEX
idx_ft_multi_position_point ON ft_multi USING GIST
(position_point);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">CREATE INDEX
idx_ft_multi_position_line ON ft_multi USING GIST
(position_line);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">CREATE INDEX
idx_ft_multi_position_polygon ON ft_multi USING GIST
(position_polygon);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">------<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">My test project, in
which I've connected to the "test_geometry" database; table
ft_geometry is not shown in the project browser ("Also list
tables with no geometry" is enabled in the connection
settings, as is "Don't resolve type of unrestricted columns
(GEOMETRY)"); table ft_multi is shown three times:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><img
style="width:4.6562in;height:5.4583in" id="Grafik_x0020_1"
src="cid:part1.sNUnoNUs.dwwoC6W0@spatialys.com" class=""
width="447" height="524"></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">One can add ft_geometry
via the Data Source Manager, by manually selecting the
spatial type:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><img
style="width:9.8333in;height:4.2604in" id="Grafik_x0020_2"
src="cid:part2.3PasfV0h.HoacBAP9@spatialys.com" class=""
width="944" height="409"></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><img
style="width:9.8645in;height:7.0208in" id="Grafik_x0020_3"
src="cid:part3.J9FpjVt4.iY10btt5@spatialys.com" class=""
width="947" height="674"></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Another way to add
ft_geometry is via the DB Manager; here is the view of
ft_geometry in the DB Manager:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><img
style="width:11.1145in;height:9.1458in"
id="Grafik_x0020_4"
src="cid:part4.q2ZNuSWz.yCLTZkur@spatialys.com" class=""
width="1067" height="878"></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">And here is the view in
the DB Manager for ft_multi (just in case):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><img
style="width:11.0833in;height:9.7916in"
id="Grafik_x0020_5"
src="cid:part5.3EeSzevx.f1euWXsF@spatialys.com" class=""
width="1064" height="940"></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">By selecting ft_geometry
in the DB Manager view of database test_geometry, then
right-clicking, the dialog with the option to "Add Layer
(Advanced)..." opens:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><img
style="width:3.8437in;height:3.7291in" id="Grafik_x0020_6"
src="cid:part6.OBks8yc2.yYgrD4qh@spatialys.com" class=""
width="369" height="358"></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">There, one can choose
the specific geometry type - as well as CRS (which should be
chosen to match the one defined in the column geometry
definition):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><img
style="width:4.0in;height:1.8854in" id="Grafik_x0020_7"
src="cid:part7.iyOB6Bz3.xCMgRVnJ@spatialys.com" class=""
width="384" height="181"></span><span lang="EN-US"><o:p></o:p></span></p>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>