[Qgis-user] Table with empty wkb_geometry

Andreas Neumann a.neumann at carto.net
Wed Jul 20 23:30:03 PDT 2011


 Hi Matej,

 I would assume that the geometries are not empty to begin with. Some 
 software (like pgadmin) does not show you a WKB geometry if the geometry 
 is too big. But this does not mean that the geometry is empty.

 There are methods in Postgis to see if the geometry is empty:
 http://postgis.refractions.net/documentation/manual-1.5/ST_IsEmpty.html

 SELECT gid FROM your_schema.your_table WHERE ST_IsEmpty(the_geom);

 There is also a method to see if a geometry is valid (contains errors):
 see 
 http://postgis.refractions.net/documentation/manual-1.5/ST_IsValidReason.html

 SELECT gid, ST_IsValidReason(the_geom) FROM your_schema.your_table 
 WHERE ST_IsValid(the_geom) = FALSE;

 Often, data imported from Shapefiles, contains errors, such as self 
 intersections, too few points, etc. - ST_IsValidReason() helps to find 
 the geometries. If you use the node tool in QGIS while in an editing 
 session, such errors are marked in green (no idea why they aren't marked 
 in red - red would be the color for errors in my opinion).

 Hope this helps.

 Andreas

 On Thu, 21 Jul 2011 00:33:29 +0200, Matej Serc wrote:
> Hi all,
>
> this is just partially connected with QGIS, but since I experience
> some behaviour which I can't understand, I will ask here.
>
> We have some parcel data which were imported to PostGIS DB from SHP
> files. I have just found out that there is a small percentage of the
> rows that have wkb_geometry field empty, but the parcel is visible in
> the QGIS, so I can click on it and Identify results etc.
>
> Basically I started looking at it more deeply when using some
> intersection functions from PostGIS that did not list some parcels
> which should by no means be listed. Now after looking at the SELECT
> query output in the pgAdmin, I see empty field for such parcels.
>
> What bothers me, is: how can these parcels be visible in QGIS? I 
> think
> that there was some problem when I was importing the data from SHP -
> but no errors were shown in ogr2ogr at that time. Did anyone already
> experienced something like this?
>
> Thank you very much for any ideas and pointers in advance :-)
> BR, Matej

-- 
 --
 Andreas Neumann
 Böschacherstrasse 10A
 8624 Grüt (Gossau ZH)
 Switzerland



More information about the Qgis-user mailing list