[postgis-devel] Re: Attributes size (was: shp2pgsql -> pgsql2shp problem)

strk at refractions.net strk at refractions.net
Wed Oct 5 05:43:22 PDT 2005


On Tue, Oct 04, 2005 at 12:49:54PM -0400, Stephen Woodbridge wrote:
> strk,
> 
> Thank you for the patch. I am out of town this week and unable to test it
> but will do so as soon as I can. I think this is a good feature to have
> but needs to be controlled via a command line switch so it can be on or
> off depending on the needs.

If you refer to pgsql2shp you can control this by altering the column
so that no limit is set on size. If no limit is set to char or varchar
attributes it will be extracted by actual values.

If you refer to shp2pgsql you can control table structure by 
using the -p (prepare) switch and manually editing it.

--strk;

> 
> Thank you,
>   -Steve W.
> 
> > On Mon, Oct 03, 2005 at 07:13:05AM -0400, Stephen Woodbridge wrote:
> >> strk at refractions.net wrote:
> >> >Stephen, no way to specify dbf attribute sizes currently.
> >> >Integer columns are output with a length of 16.
> >> >Floating values with a length of 32.
> >>
> >> OK, I can probably live with the Integer and Floating column changes,
> >> but the character column width are also changing. When I load and
> >> extract a shapefile the character columns widths change and they seem to
> >> change a different amount for each file loaded and extracted. I am
> >> assuming that there is a query to fine the max width of the data and to
> >> set the width of the column to the max. This is great if it is an
> >> option, but if you try to extract a province worth of data for each
> >> province then the column width varies with each file and you can not use
> >> the data in a mapserver tileindex.
> >
> > You're assumption is right, max width is extracted from actual values.
> >
> > The attached patch makes pgsql2shp use the length limits set to char
> > and varchar attributes, if any. And shp2pgsql set length limits for
> > dbf attributes of type STRING.
> >
> > Before committing, I'd like to gather some feedback as there might
> > be cases of failures due to malformed shapefiles. These cases
> > might be handled by using the -p (prepare) switch and manually
> > editing the receiving table structure or adding yet another switch
> > to avoid setting limits on STRING attributes.
> >
> > Comments welcome.
> > The patch applies to current CVS (head branch).
> >
> > --strk;
> >
> 



More information about the postgis-devel mailing list