Error's while retrieving data from postgres to Qgis using python?

المشرف العام

Administrator
طاقم الإدارة
This is my code of python in qgis from qgis documentation docs


code
-uri = QgsDataSourceURI()
-uri.setConnection("localhost","5432","gis_data","postgres","vajja")
-uri.setDataSource("","poi_sv1","long","","lat")
-vlayer = QgsVectorLayer(uri.uri(),"LayerName","postgres")
-crs = QgsCoordinateReferenceSystem()
-crs.createFromProj4("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
-QgsMapLayerRegistry.instance().addMapLayer(vlayer)


Error:
NOTICE: WARNING: there is no transaction in progress


Erroneous query: SELECT DISTINCT upper(geometrytype("long")),st_srid("long"),st_ndims("long") FROM "poidata"."poi_sv" returned 7 [ERROR: function geometrytype(double precision) does not exist LINE 1: SELECT DISTINCT upper(geometrytype("long")),st_srid("long"),..


HINT: No function matches the given name and argument types. You might need to add explicit type casts. ]


invalid PostgreSQL layer

My datatypes are in text and double precision.It tried both longitude and latitude in text and double precision but still it isn't working.



أكثر...
 
أعلى