Can anyone explain how it is that the shp2pgsql
loader for loading shapefiles into PostGIS goes about defining the schema for a table when importing a shapefile?
To further explain, shapefiles are comprised of geometry plus attributes of different data types and lengths: text, float, double, etc. When running shp2pgsql
with the -c
option to create a table, it defines the data types on its own somehow, but it's not clear how this happens. The only other option that looks related is -i
, to use int4 for all integer fields.
Does it read into the file to find out the lengths of data values and consider those first? Does it just assume basic things like text, integer, and float with default lengths?