0

I have hosted QGIS server on a remote server. I want to publish OSM layer which is stored in PostgreSQL database. I have prepared one project file with .qgis extension and copied to the desired directory on hosted server. Now while accessing this layer as WMS service QGIS server is not able to generate the tiles for planet_osm_polygon layer and giving error in qgis-000.log as:

Layer 'planet_osm_polygon20180803120119097' configFile: /usr/lib/cgi-bin/wms_prj/gpolygon.qgs not found in layer cache'

Note: I am able to generate the map tile if publising other OSM layer like planet_osm_point, planet_osm_line, planet_osm_roads.

Can anyone please guide me how to resolve it. I have made the same configration in my project file (.qgis) as I am doing it for other layers but only I am getting error for planet_osm_polygon layer.

1 Answer 1

1

I think the problem may have to do with the geometry type definition of the 'way' column that stores the geometries in each table. If you look at the column definitions in PgAdmin, you will notice that the Polygon table, as the one exception, does not have a clearly defined geometry type, but uses the generic "Geometry" column type, that can essentially store a mix of any of the supported PostGIS data types. I suspect QGIS Server does not like this.

A relevant GitHub link in the osm2pgsql repository related to this topic is this one:

https://github.com/openstreetmap/osm2pgsql/issues/573

It seems largely a historic decision...

E.g. compare this for the planet_osm_point table:

ALTER TABLE public.planet_osm_point ADD COLUMN way geometry(Point,4326)

with this for the planet_osm_polygon table:

ALTER TABLE public.planet_osm_polygon ADD COLUMN way geometry(Geometry,4326)

Maybe you could solve the issue by defining some (materialized?) view and do the type conversion in the view definition.

2
  • Thanks Marco_B, your guess was correct. I tried it again by altering my column with the following queries: ALTER TABLE planet_osm_polygon ALTER COLUMN way TYPE geometry(MultiPolygon,3857) USING ST_Multi(way); Commented Aug 8, 2018 at 11:38
  • OK, nice to hear it was of help. Mark it as answer if it truly solved your issue, so others can benefit from it.
    – Marco_B
    Commented Aug 8, 2018 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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