2

I just downloaded QGIS 2.2 to check it out and now one (just the one) of the tables from one of my PostgreSQL database won't display.

It loads just fine in 2.0. The records are all there (there's only 3 in this case), I can see them in the attribute table, I can query them, but they don't show up on the map.

When I try to zoom to a particular feature it pans the map down to the origin of the datum (coordinates 0,0) - but when I zoom to the extent of the layer it sets the map back to where it is supposed to be.

What am I missing in the jump from 2.0 to 2.2?

  • Can you share a table dump? I haven't seen such an issue and as you say it only affects one of your tables so it might be really hard to reproduce. – underdark Mar 6 '14 at 17:44
  • I'll just be honest and say I don't know what that is... A link for instructions perhaps? I'm running Postgres 9.1 as part of the OpenGeo suite. – Kevin Mar 6 '14 at 19:09
4

I noticed the same behavior. Upon further investigation, it was only tables with 4d dimensions (In my case MultiPolygonZM) that wouldn't display in QGIS 2.2. I didn't test 3dm or 3dz as I don't have any data handy. You can check the coord_dimension column of your geometry_columns view.

If the Z/M coordinates are not important, you can ditch them like this:

ALTER TABLE schema.table ALTER COLUMN geom TYPE geometry(MULTIPOLYGON,4326) USING ST_Force2d(geom);

Or create a view of the table with 2d coordinates for display purposes using ST_Force2d.

If you have many tables to fix, I wrote a quick python loop to take care of the problem: https://gist.github.com/guitar1999/9442467

  • The script was very helpful, I appreciate you sharing it! I don't have a ton to do but I was unsure of how to alter the table correctly. I was able to figure it out from your code - again, many thanks! – Kevin Mar 18 '14 at 16:50

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.