Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

After loading a polygon shapefile into PostGIS, the geometry column (geom) is blank for several features. In one case, only a single feature has the geometry calculated and all others are blank.

I'm using the PostGIS SHP and DBF loader v.2.0. I am creating a spatial index, and using COPY rather than INSERT.

I have loaded several other point datasets and they geom column is populated just fine...

(Otherwise, things are working just fine for the polygons: when I create a new feature, the geometry is calculated / geom field populated...etc.)

Have I done something wrong when importing the data?


Solution by @ThomasG77 (in comments)

PgAdmin3 [doesn't] display features that are too complex but they are present. You can try SELECT length(ST_astext(the_geom)) from your_table to confirm or you can find "true" empty geometry with SELECT * from your_table WHERE the_geom IS NULL;.

share|improve this question
2  
I've done similar things in postgis 1.5 and 2.0 and things went smooth. Probably you need to edit your post to add some additional details about how you're doing things. It'd be good also to have there the output of ogrinfo yourpolygon.shp –  Gery May 28 '13 at 20:43
    
@Gery: I've added the tool I used...not sure what else to add...and I'm not sure where to find the file you're refencing... –  mapBaker May 28 '13 at 21:07
    
The file is just an example, I meant your polygon shapefile, so use the ogrinfo command to get the details of your polygon shape, then edit your initial post with that. Also add the code you're using to load the shape and create the index. In that way, people can tell you what's going on and where the problem can be. Hence, that will help you to solve your issue. –  Gery May 28 '13 at 21:11
2  
When you say "blank", you don't speak about the PgAdmin3 view? If it's the case, FYI, PgAdmin3 don't display them when features are too complex but they are present. You can try SELECT length(ST_astext(the_geom)) from your_table to confirm or you can find "true" empty geometry with SELECT * from your_table WHERE the_geom IS NULL; –  ThomasG77 May 28 '13 at 22:37
1  
Since you have found a solution to the problem, it would be really useful if that was added as an actual answer to the question and then accepted. Perhaps @ThomasG77 could write up the answer since it seems you derived it from him. Answers in comments are not searchable and thus won't help someone else with a similar problem. If the solution is placed as an actual answer, it will show up when someone else searches for it either on the site directly, or through google. Glad you found a solution! –  Get Spatial May 29 '13 at 15:39

1 Answer 1

up vote 1 down vote accepted

Per comments, in occasions the geom column might not be visible to the client as a human readable string (a geom column is encoded as an EWTB - Extended Well Known Binary ).

There are two ways to visually check if the geom column is populated:

  1. Load the table to your favourite gis client (eg. Qgis)
  2. Count the NULL and NOT NULL values of the geom column :
      SELECT COUNT(geom), 'null_tally' AS narrative 
      FROM 'myTable' 
      WHERE a IS NULL 
      UNION
      SELECT COUNT(geom), 'not_null_tally' AS narrative 
      FROM 'myTable'  
      WHERE a IS NOT NULL;

count sql snippet from : http://stackoverflow.com/questions/1271810/counting-null-and-non-null-values-in-a-single-query )

share|improve this answer
    
thank you @nickves! –  mapBaker May 29 '13 at 17:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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