planetfederal / qgis-suite-plugin

GNU General Public License v2.0
25 stars 17 forks source link

More issues publishing postgis layers from qgis2.2 #142

Open rful011 opened 10 years ago

rful011 commented 10 years ago

I am trying to publish a project from QGIS 2.2. All the layers are based on queried on two postgis tables. One holding line data and the other one with point data. I notice that both these tables have turned up as layers on geoserver even though none of the layers in the project uses all the rows. Both were in a PostGIS data store and the plugin had clearly exported credentials.

BTW when I first start the plugin I get warning about geoserver being an old version -- I am running 2.5.1 on Mac OS. Is there a newer version I should be using? At this stage this whole effort is experimental and I am happy to install beta versions so long as it is reasonably straight forward.

In most cases the queries are of the form -- select * from table where type = 'xxx' although one is a complex nested join against a couple of other tables with no geometry.

I have been using the report button when things fail but I will post them here too along with the logs from Geoserver.

BTW I am an experienced programmer (although python is not my favourite poison ;) I am just getting started on programming with qgis and I am happy to help with debugging if someone points me in the right direction.

Current errors:

ried to make a GET request to http://localhost:8080/geoserver/rest/workspaces/Tiri/datastores/tiri_/featuretypes/%28select%20id%2C%20gid%2C%20the_geom%2C%20layer_name%20from%20base.line_master%2C%20base.line_feature%20where%20gid%20%3D%20feature_gid%0A%29.xml but got a 404 status code: No such feature type: Tiri,tiri_,(select id, gid, the_geom, layer_name from base.line_master, base.line_feature where gid = feature_gid ) Traceback (most recent call last): File "/Users/rful011/.qgis2/python/plugins/opengeo/gui/explorer.py", line 118, in run command(*params) File "/Users/rful011/.qgis2/python/plugins/opengeo/gui/confirm.py", line 18, in publishLayer catalog.publishLayer(layer, workspace, overwrite, name) File "/Users/rful011/.qgis2/python/plugins/opengeo/qgis/catalog.py", line 379, in publishLayer self.upload(layer, workspace, overwrite, title) File "/Users/rful011/.qgis2/python/plugins/opengeo/qgis/catalog.py", line 245, in upload self._publishExisting(layer, workspace, overwrite) File "/Users/rful011/.qgis2/python/plugins/opengeo/qgis/catalog.py", line 182, in _publishExisting self.catalog.publish_featuretype(uri.table(), store, layer.crs().authid()) File "/Users/rful011/.qgis2/python/plugins/opengeo/ext-libs/gsconfig-0.6.6-py2.7.egg/geoserver/catalog.py", line 455, in publish_featuretype feature_type.fetch() File "/Users/rful011/.qgis2/python/plugins/opengeo/ext-libs/gsconfig-0.6.6-py2.7.egg/geoserver/support.py", line 145, in fetch self.dom = self.catalog.get_xml(self.href) File "/Users/rful011/.qgis2/python/plugins/opengeo/ext-libs/gsconfig-0.6.6-py2.7.egg/geoserver/catalog.py", line 187, in get_xml raise FailedRequestError("Tried to make a GET request to %s but got a %d status code: \n%s" % (resturl, response.status, content)) FailedRequestError: Tried to make a GET request to http://localhost:8080/geoserver/rest/workspaces/Tiri/datastores/tiri/featuretypes/%28select%20id%2C%20gid%2C%20the_geom%2C%20layer_name%20from%20base.line_master%2C%20base.line_feature%20where%20gid%20%3D%20featuregid%0A%29.xml but got a 404 status code: No such feature type: Tiri,tiri,(select id, gid, the_geom, layer_name from base.line_master, base.line_feature where gid = feature_gid )

geoserver logs:

No such layer: zones

No such layer: zones

PUT style zones No such feature type: Tiri,tiri_,(select id, gid, the_geom, layer_name from base.line_master, base.line_feature where gid = feature_gid )

Loaded feature type '(select id, gid, the_geom, layer_name from base.line_master, base.line_feature where gid = feature_gid )', enabled Trying to create new feature type inside the store, but no attributes were specified

No such feature type: Tiri,tiri_,(select id, gid, the_geom, layer_name from base.line_master, base.line_feature where gid = feature_gid )

Ah! a thought! could this be a schema issue?? The sql always fully qualifies table names.

ischneider commented 10 years ago

If I understand correctly, it looks like we're not handling queried/filtered layers correctly. Note the layer name in geoserver contains the SQL that QGIS is using for the layer. At the moment, this looks like a bug you won't be able to workaround through QGIS, but for now you can use a view in postgres or a 'virtual table' in geoserver: http://docs.geoserver.org/stable/en/user/data/database/sqlview.html

Did you (or can you) publish the layer without a filter to geoserver?

Thanks for the report.

rful011 commented 10 years ago

yes, one of the qgis layers is the whole of the 'line_master' table and that has appeared in geoserver. What is odd is that wp_master is also there but I don't have it as a layer in qgis??

I just tried deleting wp_master and then loading one of the layers it is based on and it reappears.

and yes, loading a layer with no filters works fine.