[QGIS-Developer] Importing shp into gpkg or PostGIS as SINGLE geometry gives MULTI?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[QGIS-Developer] Importing shp into gpkg or PostGIS as SINGLE geometry gives MULTI?

pcav
Hi all,

I have a shp with a single line. I drag and drop it from DB Manager into
either a geopackage or PostGIS, choosing "single instead of multi"
option. The resulting layer is still multi, as shown in DB Manager
itself; same thing with a memory layer, it works. QGIS 3.4
to me it looks like a bug. opinions?
cheers.

--
Paolo Cavallini - www.faunalia.eu
QGIS.ORG Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Importing shp into gpkg or PostGIS as SINGLE geometry gives MULTI?

Andrea Peri
I guess in a geopck it could reduce a multi in single only if it was a multi but with one part only for every geometry.

A.


Il mar 1 ott 2019, 06:42 Paolo Cavallini <[hidden email]> ha scritto:
Hi all,

I have a shp with a single line. I drag and drop it from DB Manager into
either a geopackage or PostGIS, choosing "single instead of multi"
option. The resulting layer is still multi, as shown in DB Manager
itself; same thing with a memory layer, it works. QGIS 3.4
to me it looks like a bug. opinions?
cheers.

--
Paolo Cavallini - www.faunalia.eu
QGIS.ORG Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Importing shp into gpkg or PostGIS as SINGLE geometry gives MULTI?

pcav
this is my case indeed: a single line
I attach a sample here.
cheers.

On 01/10/19 07:01, Andrea Peri wrote:

> I guess in a geopck it could reduce a multi in single only if it was a
> multi but with one part only for every geometry.
>
> A.
>
>
> Il mar 1 ott 2019, 06:42 Paolo Cavallini <[hidden email]
> <mailto:[hidden email]>> ha scritto:
>
>     Hi all,
>
>     I have a shp with a single line. I drag and drop it from DB Manager into
>     either a geopackage or PostGIS, choosing "single instead of multi"
>     option. The resulting layer is still multi, as shown in DB Manager
>     itself; same thing with a memory layer, it works. QGIS 3.4
>     to me it looks like a bug. opinions?
>     cheers.
>
>     --
>     Paolo Cavallini - www.faunalia.eu <http://www.faunalia.eu>
>     QGIS.ORG <http://QGIS.ORG> Chair:
>     http://planet.qgis.org/planet/user/28/tag/qgis%20board/
>     _______________________________________________
>     QGIS-Developer mailing list
>     [hidden email] <mailto:[hidden email]>
>     List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>     Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
> _______________________________________________
> QGIS-Developer mailing list
> [hidden email]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
--
Paolo Cavallini - www.faunalia.eu
QGIS.ORG Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/

_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

errore _processamento.zip (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Importing shp into gpkg or PostGIS as SINGLE geometry gives MULTI?

DelazJ
Hi
I may be wrong but I think this "issue" has been raised in the past (with Processing? By Matteo?) and from what I understood in the discussion, shapefiles are multi by default, not single (even if the features are of single part, the layer is identified as multi). Reason why they are handled as such.
Hoping that I do not say nonsense and confuse people more than necessary...

Regards,
Harrissou

Le 1 octobre 2019 07:03:24 GMT+02:00, Paolo Cavallini <[hidden email]> a écrit :
this is my case indeed: a single line
I attach a sample here.
cheers.

On 01/10/19 07:01, Andrea Peri wrote:
I guess in a geopck it could reduce a multi in single only if it was a
multi but with one part only for every geometry.

A.


Il mar 1 ott 2019, 06:42 Paolo Cavallini <[hidden email]
<mailto:[hidden email]>> ha scritto:

Hi all,

I have a shp with a single line. I drag and drop it from DB Manager into
either a geopackage or PostGIS, choosing "single instead of multi"
option. The resulting layer is still multi, as shown in DB Manager
itself; same thing with a memory layer, it works. QGIS 3.4
to me it looks like a bug. opinions?
cheers.

--
Paolo Cavallini - www.faunalia.eu <http://www.faunalia.eu>
QGIS.ORG <http://QGIS.ORG> Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/
QGIS-Developer mailing list
[hidden email] <mailto:[hidden email]>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Importing shp into gpkg or PostGIS as SINGLE geometry gives MULTI?

pcav
Correct, but in the importing popup there is an option to transform into single. It usually works, at least for points, so it's unclear why it shouldn't in this case.
Cheers.

On 1 October 2019 08:54:09 EEST, Harrissou <[hidden email]> wrote:
Hi
I may be wrong but I think this "issue" has been raised in the past (with Processing? By Matteo?) and from what I understood in the discussion, shapefiles are multi by default, not single (even if the features are of single part, the layer is identified as multi). Reason why they are handled as such.
Hoping that I do not say nonsense and confuse people more than necessary...

Regards,
Harrissou

Le 1 octobre 2019 07:03:24 GMT+02:00, Paolo Cavallini <[hidden email]> a écrit :
this is my case indeed: a single line
I attach a sample here.
cheers.

On 01/10/19 07:01, Andrea Peri wrote:
I guess in a geopck it could reduce a multi in single only if it was a
multi but with one part only for every geometry.

A.


Il mar 1 ott 2019, 06:42 Paolo Cavallini <[hidden email]
<mailto:[hidden email]>> ha scritto:

Hi all,

I have a shp with a single line. I drag and drop it from DB Manager into
either a geopackage or PostGIS, choosing "single instead of multi"
option. The resulting layer is still multi, as shown in DB Manager
itself; same thing with a memory layer, it works. QGIS 3.4
to me it looks like a bug. opinions?
cheers.

--
Paolo Cavallini - www.faunalia.eu <http://www.faunalia.eu>
QGIS.ORG <http://QGIS.ORG> Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/
QGIS-Developer mailing list
[hidden email] <mailto:[hidden email]>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


--
Sorry for being short
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Importing shp into gpkg or PostGIS as SINGLE geometry gives MULTI?

Giovanni Manghi
In reply to this post by Andrea Peri

Correct, but in the importing popup there is an option to transform into single. It usually works, at least for points, so it's unclear why it shouldn't in this case.
Cheers.


despite its name, that has been always confusing, that option in DB Manager never transformed geometries to SINGLE from MULTI along the import process).

What the option means (meant?) is that if I have a layer that is declared as MULTI but actually has no multipart geometries in it, then it can be imported as a non-MULTI table.

In past QGIS releases if you had a layer with a multi-geometry and checked that option then DB manager returned an error like

Error 7

Feature write errors:

Creation error for features from #0 to #0. Provider errors was:

Geometry type MultiLineString not compatible with provider type LineString.

PostGIS error while adding features: ERROR: Geometry type (MultiLineString) does not match column type (LineString)


now it does not and imports to MULTI anyway and silently. And it does also if you don't have any multi-geometry, which of course are both bugs and regressions.


Error 7

Feature write errors:

Creation error for features from #0 to #0. Provider errors was:

Geometry type MultiLineString not compatible with provider type LineString.

PostGIS error while adding features: ERROR: Geometry type (MultiLineString) does not match column type (LineString)

-- G --





_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Importing shp into gpkg or PostGIS as SINGLE geometry gives MULTI?

pcav
Thanks Giovanni for the detailed reply.

On 01/10/19 19:17, Giovanni Manghi wrote:

>
>     Correct, but in the importing popup there is an option to transform
>     into single. It usually works, at least for points, so it's unclear
>     why it shouldn't in this case.
>     Cheers.
>
>
>
> despite its name, that has been always confusing, that option in DB
> Manager never transformed geometries to SINGLE from MULTI along the
> import process).
>
> What the option means (meant?) is that if I have a layer that is
> declared as MULTI but actually has no multipart geometries in it, then
> it can be imported as a non-MULTI table.
>
> In past QGIS releases if you had a layer with a multi-geometry and
> checked that option then DB manager returned an error like
> ...
> now it does not and imports to MULTI anyway and silently. And it does
> also if you don't have any multi-geometry, which of course are both bugs
> and regressions.

agreed. do you know whether there is a ticket for this?
in some cases this is really a blocker.
Cheers.
--
Paolo Cavallini - www.faunalia.eu
QGIS.ORG Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Importing shp into gpkg or PostGIS as SINGLE geometry gives MULTI?

pcav
Hi

On 02/10/19 06:36, Paolo Cavallini wrote:

> Thanks Giovanni for the detailed reply.
>
> On 01/10/19 19:17, Giovanni Manghi wrote:
>>
>>     Correct, but in the importing popup there is an option to transform
>>     into single. It usually works, at least for points, so it's unclear
>>     why it shouldn't in this case.
>>     Cheers.
>>
>>
>>
>> despite its name, that has been always confusing, that option in DB
>> Manager never transformed geometries to SINGLE from MULTI along the
>> import process).
>>
>> What the option means (meant?) is that if I have a layer that is
>> declared as MULTI but actually has no multipart geometries in it, then
>> it can be imported as a non-MULTI table.
>>
>> In past QGIS releases if you had a layer with a multi-geometry and
>> checked that option then DB manager returned an error like
>> ...
>> now it does not and imports to MULTI anyway and silently. And it does
>> also if you don't have any multi-geometry, which of course are both bugs
>> and regressions.
>
> agreed. do you know whether there is a ticket for this?
> in some cases this is really a blocker.

here we go:
https://github.com/qgis/QGIS/issues/23411
Thanks again.
--
Paolo Cavallini - www.faunalia.eu
QGIS.ORG Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer