Smathermather's Weblog

Remote Sensing, GIS, Ecology, and Oddball Techniques

Shapfile spatial indices and PostGIS dumps

Posted by smathermather on July 19, 2010

Another short post… . I have in place a framework for maintenance of our boundary data that works really well. I feed an edited shapefile into the database, and PostGIS creates all the versions of the boundary that need created. The database then exports the managed data to shapefile so there is a database version and a shapefile version depending on need.

When all was said and done, I had several shapefiles that displayed at some zoom levels in ArcGIS, but not others. Google to the rescue:
http://forums.esri.com/Thread.asp?c=93&f=1730&t=164942
I had outdated spatial indices that are not created by pgsql2shp, and since they didn’t reflect the real geometry, ArcGIS was choking on them and not displaying them properly. In the above link, Kirk Kuykendall suggests fixing the index in ArcCatalog. For me, the geometry is simple enough, I just deleted the index (*.sbn) with no noticeable performance hit.

2 Responses to “Shapfile spatial indices and PostGIS dumps”

  1. Paul said

    So are only the affected shapefiles updated, or all?

  2. smathermather said

    Any time there’s a change to the parent table, there is a change to all the child tables, thus all the shapefiles also need updated. Under other scenarios, I could envision a case where only certain tables get updated. In this case, some sort of compatibility layer would be needed between the shapefiles and the database tables in order to compare the indices of the two to determine whether an update would be necessary.

    A potential utility for accomplishing this would be SpatiaLite: http://www.gaia-gis.it/spatialite/ as it has the ability to interact with shapefiles as virtual tables using the VirtualShape extension. I assume VirtualShapes can take advantage of indexing, but I haven’t given this much thought.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: