[Gdal-dev] PostGIS varchar fields

Frank Warmerdam warmerdam at pobox.com
Tue Jan 10 23:20:00 EST 2006


On 1/10/06, William Kyngesburye <woklist at kyngchaos.com> wrote:
> I'm not sure if it's supposed to work this way or not:  I extracted
> an area out of a big PostGIS database, to shapefile, and all the
> varchar fields from PostGIS became character fields of length 80.  So
> all those 2-8 varchar fields in the attributes balloon the dbf, and
> the few 200 char name fields get chopped off.
>
> ogrinfo -al -so on the PostGIS DB returns "String (0.0)" for the
> field type for all varchar fields, but the correct length for all
> fixed char fields (a few 1 and 2-char fields).  The original mif/mid
> source I used to create the PostGIS DB with ogr2ogr returns the
> correct length for all char fields.  A direct ogr2ogr from the mif/
> mid to shapefile also creates the correct field lengths in the
> shapefile, although the integer fields get changed to reals.

William,

Is there any change you used the -lco PRECISION=FALSE
option when copying the data into postgres?  If so, VARCHAR
gets used for fixed length fields otherwise the fixed length
string fields should be created as CHAR(length).

The PRECISION layer creation should default to TRUE
according to the code and docs.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list