0

I've some problems with using a PostGIS layer within QGIS. First of all, I had this same problem on both QGIS 2.4.0 and 2.6.1 I cannot display the Google Maps layer AND my PostGIS layer together. First of all, my PostGIS layer has the same SRID of GoogleMaps (i.e. 3857). I checked it with

SELECT Find_SRID('public', 'l001', 'the_geom')

then I read here and in other blogs that it can be a proxy problem so I checked the "Use a Proxy for web access

enter image description here

but when I do this and try to load again the Google Maps layer, I get the following error:

Traceback (most recent call last): File "C:/Users/pgcom120/.qgis2/python/plugins\openlayers_plugin\weblayers\weblayer.py", line 97, in addLayer self._addLayerCallback(self) File "C:/Users/pgcom120/.qgis2/python/plugins\openlayers_plugin\openlayers_plugin.py", line 130, in addLayer layer = OpenlayersLayer(self.iface, self._olLayerTypeRegistry) File "C:/Users/pgcom120/.qgis2/python/plugins\openlayers_plugin\openlayers_layer.py", line 330, in init self.olWebPage = OLWebPage(self) File "C:/Users/pgcom120/.qgis2/python/plugins\openlayers_plugin\openlayers_layer.py", line 48, in init proxy = getProxy() File "C:/Users/pgcom120/.qgis2/python/plugins\openlayers_plugin\tools_network.py", line 42, in getProxy proxy.setPort(settings.value("/proxyPort", 10, type=int)) TypeError: unable to convert a QVariant of type 10 to a QMetaType of type 2 Versione Python: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] Versione di QGIS: 2.4.0-Chugiak Chugiak, 8fdd08a Percorso Python: ['C:/PROGRA~1/QGISCH~1/apps/qgis/./python/plugins\processing', 'C:/PROGRA~1/QGISCH~1/apps/qgis/./python', u'C:/Users/pgcom120/.qgis2/python', u'C:/Users/pgcom120/.qgis2/python/plugins', 'C:/PROGRA~1/QGISCH~1/apps/qgis/./python/plugins', 'C:\PROGRA~1\QGISCH~1\bin\python27.zip', 'C:\PROGRA~1\QGISCH~1\apps\Python27\DLLs', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\plat-win', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\lib-tk', 'C:\PROGRA~1\QGISCH~1\bin', 'C:\PROGRA~1\QGISCH~1\apps\Python27', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\PIL', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win-amd64.egg', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\pytz-2012j-py2.7.egg', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\win32', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\win32\lib', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\Pythonwin', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win-amd64.egg', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\six-1.3.0-py2.7.egg', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\xlrd-0.9.2-py2.7.egg', 'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\xlwt-0.7.5-py2.7.egg', 'C:/Users/pgcom120/.qgis2/python/plugins\DataDrivenInputMask', 'C:\Users\pgcom120\.qgis2\python\plugins\mmqgis/forms', 'C:\Users\pgcom120\.qgis2\python\plugins\QuickMultiAttributeEdit/forms', 'C:\PROGRA~1\QGISCH~1\apps\qgis\python\plugins\fTools\tools', 'C:/ProgettoQGIS2015']

I've also downloaded the Openlayers_plugin and put it in

C:\OSGeo4W64\apps\qgis\python\plugins

but still nothing has changed. The less worse result I obtained till now is this:

enter image description here

where I didn't flag the proxy option.

  • 1
    your data falls near the 0,0 coordinates of mercator. I suggest that you try to change the SRID of your postgis data to 4326 – radouxju Apr 13 '15 at 16:06
1

Judging from the location of your point, I'm willing to bet that your data is in EPSG:4326 rather than EPSG:3857.

Confusing latitude/longitude values with web Mercator X/Y values usually results in a point near the Equator/Prime Meridian intersection.

  • yes indeed! Thank you @Mintx!! last night I realized that my Lat and Long (which were derived from google) were given according to the SRID 4326...now I'm try to using the ST_Transform command, but I always bump into this mistake: ERRORE: Geometry SRID (3857) does not match column SRID (4326) the query I'm using is ALTER TABLE "GeoLocalita" ALTER COLUMN "the_geom" TYPE geometry(Point,4326) USING ST_Transform("the_geom",3857) what I'm doing wrong now?? – user3520314 Apr 14 '15 at 7:30
0

Try setting project CRS first to EPSG:3857 with On-The-fly-reprojectionenabled, then add a layer from the openlayers plugin, then add your postgis datasource.

If that does not work, please add the extent of the postgis layer, as reported by rightclick, Properties, metadata tab.

  • I followed your suggestion by still get that single point. I guess this is the info your where asking for: dbname='pg_2' host=localhost port=5433 user='postgres' sslmode=disable key='ID' srid=3857 type=POINT table="public"."GeoLocalita" (the_geom) sql= – user3520314 Apr 13 '15 at 14:48
  • The extent is further down in the properties box. – AndreJ Apr 13 '15 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.