TransWikia.com

When importing shapefile attributes (in a DBF) does the order of columns matter?

Geographic Information Systems Asked by oddball on December 27, 2020

I’m working to import a batch of 250+ shapefiles into PostGIS. I’m using the shp2pgsql utility to load data.

While doing some basic preparation I’ve realized that a few are missing 1-2 columns (varies depending on the file).

I’m wondering, during the import process for attributes is it just the column headers that are used to identify the fields or is it the placement in the DBF file?

I have written a few basic C# programs that can add fields to a DBF without a problem.

My question is whether I can add the missing columns at the end of the DBF and if it’ll import correctly.

Here is an example:

Template
Column A, Column B, Column C, Column D, Column E, Column F

Missing file (adjusted)
Column A, Column C, Column D, Column F, Column C, Column E

Trying to get a sense of if this will work before embarking on code that rewrites the entire DBF file. It is a LOT easier to add fields at the end.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP