Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTF turned on when adding a (non spatial) postgresql table #25331

Closed
qgib opened this issue Nov 9, 2017 · 4 comments
Closed

OTF turned on when adding a (non spatial) postgresql table #25331

qgib opened this issue Nov 9, 2017 · 4 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Easy fix Projections/Transformations Related to coordinate reference systems or coordinate transformation

Comments

@qgib
Copy link
Contributor

qgib commented Nov 9, 2017

Author Name: Donovan Cameron (@saultdon)
Original Redmine Issue: 17434
Affected QGIS version: 2.18.14
Redmine category:projection_support


I've got a postgresql/postgis database and some tables are non-spatial.

They are uploaded to postgresql using the ogr2ogr option @-nlt NONE@

If I add one of these tables to QGIS when there are already some spatial tables in the map canvas, OTF is enabled assuming the non-spatial tables are WGS84.

Maybe when adding a table that has no geometry defined QGIS shouldn't be turning OTF on when it's probably not needed.

@qgib
Copy link
Contributor Author

qgib commented Nov 9, 2017

Author Name: Donovan Cameron (@saultdon)


Here's the debug output when the non-spatial table is added after there are already spatial tables in the map canvas.

@src/app/qgsbrowserdockwidget.cpp: 572: (addLayerAtIndex) [12612ms] rowCount() = 0
src/app/qgsbrowserdockwidget.cpp: 555: (addLayer) [1ms] postgres : dbname='witaskewin' host=sfngis port=5432 sslmode=require table="bcgov_mngd"."tbl_png_title_conditions" sql=
src/app/qgisapp.cpp: 9300: (addVectorLayer) [0ms] Creating new vector layer using dbname='witaskewin' host=sfngis port=5432 sslmode=require table="bcgov_mngd"."tbl_png_title_conditions" sql= with baseName of tbl_png_title_conditions and providerKey of postgres
src/core/qgsproviderregistry.cpp: 377: (provider) [0ms] Library name is /usr/lib/qgis/plugins/libpostgresprovider.so
src/providers/postgres/qgspostgresprovider.cpp: 94: (QgsPostgresProvider) [0ms] URI: dbname='witaskewin' host=sfngis port=5432 sslmode=require table="bcgov_mngd"."tbl_png_title_conditions" sql=
src/core/qgis.cpp: 186: (fromNewWkbType) [0ms] unexpected new wkbType=0
src/providers/postgres/qgspostgresprovider.cpp: 130: (QgsPostgresProvider) [0ms] Connection info is dbname='witaskewin' host=sfngis port=5432 sslmode=require
src/providers/postgres/qgspostgresprovider.cpp: 131: (QgsPostgresProvider) [0ms] Geometry column is:
src/providers/postgres/qgspostgresprovider.cpp: 132: (QgsPostgresProvider) [0ms] Schema is: bcgov_mngd
src/providers/postgres/qgspostgresprovider.cpp: 133: (QgsPostgresProvider) [0ms] Table name is: tbl_png_title_conditions
src/providers/postgres/qgspostgresprovider.cpp: 134: (QgsPostgresProvider) [0ms] Query is: "bcgov_mngd"."tbl_png_title_conditions"
src/providers/postgres/qgspostgresprovider.cpp: 135: (QgsPostgresProvider) [0ms] Where clause is:
src/providers/postgres/qgspostgresconn.cpp: 157: (connectDb) [0ms] Using cached connection for dbname='witaskewin' host=sfngis port=5432 sslmode=require
src/providers/postgres/qgspostgresprovider.cpp: 1055: (hasSufficientPermsAndCapabilities) [0ms] Checking for permissions on the relation
src/providers/postgres/qgspostgresprovider.cpp: 744: (loadFields) [4ms] Loading fields for table tbl_png_title_conditions
src/providers/postgres/qgspostgresprovider.cpp: 1251: (determinePrimaryKey) [6ms] Checking whether SELECT count(*) FROM pg_inherits WHERE inhparent='"bcgov_mngd"."tbl_png_title_conditions"'::regclass is a parent table
src/providers/postgres/qgspostgresprovider.cpp: 1256: (determinePrimaryKey) [1ms] Retrieving first primary or unique index: SELECT indexrelid FROM pg_index WHERE indrelid='"bcgov_mngd"."tbl_png_title_conditions"'::regclass AND (indisprimary OR indisunique) ORDER BY CASE WHEN indisprimary THEN 1 ELSE 2 END LIMIT 1
src/providers/postgres/qgspostgresprovider.cpp: 1259: (determinePrimaryKey) [1ms] Got 1 rows.
src/providers/postgres/qgspostgresprovider.cpp: 1327: (determinePrimaryKey) [0ms] Retrieving key columns: SELECT attname,attnotnull FROM pg_index,pg_attribute WHERE indexrelid=2100944 AND indrelid=attrelid AND pg_attribute.attnum=any(pg_index.indkey)
src/providers/postgres/qgspostgresprovider.cpp: 1329: (determinePrimaryKey) [0ms] Got 1 rows.
src/core/qgsproviderregistry.cpp: 399: (provider) [1ms] Instantiated the data provider plugin: postgres
src/core/qgsvectorlayer.cpp: 1733: (setDataProvider) [0ms] Instantiated the data provider plugin
src/core/qgsvectorlayer.cpp: 1759: (setDataProvider) [0ms] Beautifying layer name tbl_png_title_conditions
src/core/qgsvectorlayer.cpp: 1783: (setDataProvider) [0ms] Beautified layer name tbl_png_title_conditions
src/core/qgsvectorlayer.cpp: 2905: (setCoordinateSystem) [0ms] ----- Computing Coordinate System
src/app/qgisapp.cpp: 9320: (addVectorLayer) [8ms] got valid layer with 0 sublayers
src/plugins/grass/qgsgrassplugin.cpp: 338: (onLayerWasAdded) [3ms] name = tbl_png_title_conditions
src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.cpp: 91: (updateLayers) [1ms] Adding layer, have 2 in list
src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.cpp: 91: (updateLayers) [0ms] Adding layer, have 2 in list
src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.cpp: 91: (updateLayers) [0ms] Adding layer, have 2 in list
src/core/qgsproviderregistry.cpp: 477: (providerLibrary) [223ms] Library name is /usr/lib/qgis/plugins/libpostgresprovider.so
src/providers/postgres/qgspostgresconn.cpp: 157: (connectDb) [0ms] Using cached connection for dbname='witaskewin' host=sfngis port=5432 sslmode=require
src/core/qgsmaplayer.cpp: 1153: (loadNamedStyle) [1ms] uri = dbname='witaskewin' host=sfngis port=5432 sslmode=require key='ogc_fid' table="bcgov_mngd"."tbl_png_title_conditions" sql= myURI = dbname='witaskewin' host=sfngis port=5432 sslmode=require key='ogc_fid' table="bcgov_mngd"."tbl_png_title_conditions" sql=
src/core/qgsmaplayer.cpp: 1175: (loadNamedStyle) [0ms] project fileName: /home/saultdon
src/core/qgsmaplayer.cpp: 1108: (loadNamedStyleFromDb) [0ms] db = /home/saultdon/.qgis2//qgis.qmldb uri = dbname='witaskewin' host=sfngis port=5432 sslmode=require key='ogc_fid' table="bcgov_mngd"."tbl_png_title_conditions" sql=
src/core/qgsmaplayer.cpp: 1118: (loadNamedStyleFromDb) [0ms] Trying to load style for "dbname='witaskewin' host=sfngis port=5432 sslmode=require key='ogc_fid' table="bcgov_mngd"."tbl_png_title_conditions" sql=" from "/home/saultdon/.qgis2//qgis.qmldb"
src/core/qgsmaplayer.cpp: 1108: (loadNamedStyleFromDb) [0ms] db = /usr/share/qgis/resources/qgis.qmldb uri = dbname='witaskewin' host=sfngis port=5432 sslmode=require key='ogc_fid' table="bcgov_mngd"."tbl_png_title_conditions" sql=
src/core/qgsmaplayer.cpp: 1118: (loadNamedStyleFromDb) [0ms] Trying to load style for "dbname='witaskewin' host=sfngis port=5432 sslmode=require key='ogc_fid' table="bcgov_mngd"."tbl_png_title_conditions" sql=" from "/usr/share/qgis/resources/qgis.qmldb"
src/gui/qgsmapcanvas.cpp: 694: (refresh) [0ms] CANVAS refresh scheduling
src/gui/qgsmapcanvas.cpp: 455: (setLayerSet) [1ms] Layers changed to: tbl_png_title_conditions20171109103132508, vw_disposition_deferred20171109103118814, png_tenure20171109103114328
src/gui/qgsmapcanvas.cpp: 493: (setLayerSet) [0ms] Layers have changed, refreshing
src/core/qgsmaprenderer.cpp: 1012: (setLayerSet) [0ms] Entering: tbl_png_title_conditions20171109103132508, vw_disposition_deferred20171109103118814, png_tenure20171109103114328
src/gui/qgsmapcanvas.cpp: 688: (refresh) [0ms] CANVAS refresh already scheduled
src/gui/qgsmapcanvas.cpp: 688: (refresh) [1ms] CANVAS refresh already scheduled
src/core/qgsmaprenderer.cpp: 665: (setProjectionsEnabled) [0ms] Adjusting DistArea projection on/off
src/gui/qgsmapcanvas.cpp: 704: (refreshMap) [5ms] CANVAS refresh!
src/core/qgsscalecalculator.cpp: 40: (setMapUnits) [1ms] Map units set to 2
src/core/qgsmaprendererjob.cpp: 182: (prepareJobs) [0ms] CACHE VALID: 1
src/core/qgsmaprendererjob.cpp: 192: (prepareJobs) [0ms] Rendering at layer item png_tenure20171109103114328
src/core/qgsmaprendererjob.cpp: 208: (prepareJobs) [0ms] layer png_tenure: minscale:0 maxscale:1e+08 scaledepvis:0 blendmode:0
src/core/qgsmaprendererjob.cpp: 226: (prepareJobs) [0ms] extent: 536019.7558401639107615,714260.9875000000465661 : 1879718.6191598360892385,1711236.5124999999534339
src/core/qgsmaprendererjob.cpp: 192: (prepareJobs) [0ms] Rendering at layer item vw_disposition_deferred20171109103118814
src/core/qgsmaprendererjob.cpp: 208: (prepareJobs) [0ms] layer vw_disposition_deferred: minscale:0 maxscale:1e+08 scaledepvis:0 blendmode:0
src/core/qgsmaprendererjob.cpp: 226: (prepareJobs) [0ms] extent: 536019.7558401639107615,714260.9875000000465661 : 1879718.6191598360892385,1711236.5124999999534339
src/core/qgsmaprendererjob.cpp: 192: (prepareJobs) [0ms] Rendering at layer item tbl_png_title_conditions20171109103132508
src/core/qgsmaprendererjob.cpp: 208: (prepareJobs) [0ms] layer tbl_png_title_conditions: minscale:0 maxscale:1e+08 scaledepvis:0 blendmode:0
src/core/qgscoordinatetransform.cpp: 538: (transformBoundingBox) [1ms] Entering transformBoundingBox...
src/core/qgscoordinatetransform.cpp: 607: (transformBoundingBox) [0ms] Projected extent: -134.3444545599743094,50.7401789866941400 : -110.3643253305413907,60.3841349261776443
src/core/qgscoordinatetransform.cpp: 538: (transformBoundingBox) [1ms] Entering transformBoundingBox...
src/core/qgscoordinatetransform.cpp: 607: (transformBoundingBox) [0ms] Projected extent: 412809.0529681741027161,636152.9973105994286016 : 2093874.2437018954660743,1806382.5284756093751639
src/core/qgsmaprendererjob.cpp: 98: (reprojectToLayerExtent) [0ms]
0:536019.7558401639107615,714260.9875000000465661 : 1879718.6191598360892385,1711236.5124999999534339 1.3437e+06x996976
1:-134.3444545599743094,50.7401789866941400 : -110.3643253305413907,60.3841349261776443
2:412809.0529681741027161,636152.9973105994286016 : 2093874.2437018954660743,1806382.5284756093751639 1.68107e+06x1.17023e+06 (w:0.251073 h:0.17378)
src/core/qgsmaprendererjob.cpp: 226: (prepareJobs) [0ms] extent: -134.3444545599743094,50.7401789866941400 : -110.3643253305413907,60.3841349261776443
src/core/qgsmaprendererparalleljob.cpp: 80: (start) [1ms] QThreadPool max thread count is 8
src/core/qgsmaprendererparalleljob.cpp: 257: (renderLayerStatic) [6ms] [thread:0x7f9d14036350] job 55a573602530 start (layer tbl_png_title_conditions20171109103132508)
src/core/qgsmaprendererparalleljob.cpp: 279: (renderLayerStatic) [0ms] [thread:0x7f9d14036350] job 55a573602530 end [0 ms] (layer tbl_png_title_conditions20171109103132508)
src/core/qgsmaprendererjob.cpp: 333: (cleanupJobs) [6ms] caching image for tbl_png_title_conditions20171109103132508
src/core/qgsmaprendererparalleljob.cpp: 218: (renderLayersFinished) [0ms] PARALLEL layers finished
src/core/qgsmaprenderercustompainterjob.cpp: 299: (drawLabeling) [0ms] [thread:0x7f9d1404dd40] Draw labeling start
src/core/qgsvectorlayer.cpp: 320: (drawLabels) [1ms] [thread:0x7f9d1404dd40] Starting draw of labels: png_tenure20171109103114328
src/core/qgsvectorlayer.cpp: 320: (drawLabels) [0ms] [thread:0x7f9d1404dd40] Starting draw of labels: vw_disposition_deferred20171109103118814
src/core/qgscoordinatetransform.cpp: 538: (transformBoundingBox) [0ms] [thread:0x7f9d1404dd40] Entering transformBoundingBox...
src/core/qgscoordinatetransform.cpp: 607: (transformBoundingBox) [0ms] [thread:0x7f9d1404dd40] Projected extent: -134.3444545599743094,50.7401789866941400 : -110.3643253305413907,60.3841349261776443
src/core/qgscoordinatetransform.cpp: 538: (transformBoundingBox) [0ms] [thread:0x7f9d1404dd40] Entering transformBoundingBox...
src/core/qgscoordinatetransform.cpp: 607: (transformBoundingBox) [1ms] [thread:0x7f9d1404dd40] Projected extent: 412809.0529681741027161,636152.9973105994286016 : 2093874.2437018954660743,1806382.5284756093751639
src/core/qgsmaprendererjob.cpp: 98: (reprojectToLayerExtent) [0ms] [thread:0x7f9d1404dd40]
0:536019.7558401639107615,714260.9875000000465661 : 1879718.6191598360892385,1711236.5124999999534339 1.3437e+06x996976
1:-134.3444545599743094,50.7401789866941400 : -110.3643253305413907,60.3841349261776443
2:412809.0529681741027161,636152.9973105994286016 : 2093874.2437018954660743,1806382.5284756093751639 1.68107e+06x1.17023e+06 (w:0.251073 h:0.17378)
src/core/qgsmaprenderercustompainterjob.cpp: 327: (drawLabeling) [0ms] [thread:0x7f9d1404dd40] Draw labeling took (seconds): 0.002
src/core/qgsmaprendererparalleljob.cpp: 238: (renderingFinished) [3ms] PARALLEL finished
src/gui/qgsmapcanvas.cpp: 756: (rendererJobFinished) [0ms] CANVAS finish! 1
src/core/layertree/qgslayertreemodel.cpp: 1513: (invalidateLegendMapBasedData) [746ms] Entering.
src/core/layertree/qgslayertreemodel.cpp: 1513: (invalidateLegendMapBasedData) [0ms] Leaving.@

@qgib
Copy link
Contributor Author

qgib commented Nov 13, 2017

Author Name: Giovanni Manghi (@gioman)


  • category_id was changed from Unknown to Projection Support
  • subject was changed from OTF turned on when adding a postgresql table to OTF turned on when adding a (non spatial) postgresql table

@qgib
Copy link
Contributor Author

qgib commented Jan 20, 2019

Author Name: Jürgen Fischer (@jef-n)


Please test with QGIS 3.4 - QGIS 2.18 reached it's end of life.


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Feb 24, 2019

Author Name: Giovanni Manghi (@gioman)


  • resolution was changed from to no timely feedback
  • status_id was changed from Feedback to Closed

@qgib qgib closed this as completed Feb 24, 2019
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Projections/Transformations Related to coordinate reference systems or coordinate transformation Easy fix labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Easy fix Projections/Transformations Related to coordinate reference systems or coordinate transformation
Projects
None yet
Development

No branches or pull requests

1 participant