I am working with a "cities" layer (polygons) in a PostgreSQL 9.1 database. When I use the following query in PostGIS:

select st_buffer(st_union(st_centroid(cities.geom)),1500) geom from "my_layer" cities

I have no problem with displaying the layer in QGIS.

When I use this syntax:

select st_union(st_buffer(st_centroid(cities.geom),1500)) geom from "my_layer" cities

No error is generated in PostGIS, the generated table has one element (as expected) the table can be opened in qgis, its extent "seems" OK but nothing appears on the screen ...

I checked objects with a ST_IsValid query and found no error. I tried adding an id but nothing changed. I tried these two queries in PostgreSQL 9.5 and had no problem at all.

What could I be doing wrong, why do I have this behavior using PostgreSQL 9.1, and what could be the workaround?

PS : PostGIS version is 1.5.3 in the first case (PostgreSQL 9.1) and 2.2.1 in the second case (I suppose it must be important ...)

  • PG 9.1 is extremely old. The PostGIS installations which supported 9.1 are also very old. Comparing a 9.5 install to 9.1 is like comparing a Playstation with an Atari 2600. If you edit the question to include the PostGIS versions involved, you'll see why this is not really a "why" issue. The workaround would be to use modern software. – Vince Dec 27 '17 at 13:26
  • Thanks for your comment. I realize the 9.1 is quite old, but i wanted to find a 'light' workaround not implying to upload my data to a newer Postgres server ... – snaileater Dec 27 '17 at 13:33
  • There have been five major releases and 41 minor ones since PostGIS 1.5.3. If you want a lightweight solution, find and install the last PostGIS that supported PG 9.1 (you might need to upgrade your 9.1 to a terminal build) – Vince Dec 27 '17 at 14:25

Your Answer

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

Browse other questions tagged or ask your own question.