Bug report #20122

Import of a layer to MS SQL fails

Added by Martin Dobias over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/MSSQL
Affected QGIS version:3.3(master) Regression?:No
Operating System:linux Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27944

Description

When I try to import the attached shapefile with one feature to MS SQL server through the browser dock, it says the import was successful but only an empty table is created, the feature is missing.

mssql-fail-slovensko.zip (430 KB) Martin Dobias, 2018-10-16 04:31 PM

Associated revisions

Revision b1fd7b5a
Added by Martin Dobias over 5 years ago

[mssql] Fix import of layers with invalid geometries (fixes #20122)

This essentially reverts 62f4534

Rationale:
- even valid geometries according to GEOS may be considered as invalid by MS SQL
so there is no way of knowing that a geometry may be fail to be added
- change of geometries applies MakeValid() so it is consistent again
- GDAL driver also applies MakeValid() on all added/changed geometries
- QGIS since 3.4 has optional geometry checks for validity etc. so some truly
invalid geometries may be fixed before submitted to the provider

See also https://github.com/qgis/QGIS/pull/8411

Revision 63b2267b
Added by Martin Dobias over 5 years ago

[mssql] Fix import of layers with invalid geometries (fixes #20122)

This essentially reverts 62f4534

Rationale:
- even valid geometries according to GEOS may be considered as invalid by MS SQL
so there is no way of knowing that a geometry may be fail to be added
- change of geometries applies MakeValid() so it is consistent again
- GDAL driver also applies MakeValid() on all added/changed geometries
- QGIS since 3.4 has optional geometry checks for validity etc. so some truly
invalid geometries may be fixed before submitted to the provider

See also https://github.com/qgis/QGIS/pull/8411

(cherry picked from commit b1fd7b5ac6471749e03765562ce86c4241990c02)

History

#1 Updated by Martin Dobias over 5 years ago

Mostly addressed by https://github.com/qgis/QGIS/pull/8411 although partially it is caused by invalid geometries (which are valid according to GEOS) - the only/easisty remedy is to get geometries auto-fixed by MakeValid function.

#2 Updated by Martin Dobias over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF