Shapfile spatial indices and PostGIS dumps

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:
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 thoughts on “Shapfile spatial indices and PostGIS dumps

  1. 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: 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: Logo

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.