[mapserver-users] Shapefile field length problem
Tamas Szekeres
szekerest at gmail.com
Tue Aug 5 04:26:27 PDT 2008
Steve,
RFC 21 has already been added in the SVN trunk so you can use the OGR
SQL to specify the field length like:
ogr2ogr -f "ESRI Shapefile" -sql "select *, CAST(myfield AS
character(255)) from mylayer" myfile.shp myfile.vrt
for more information see:
http://trac.osgeo.org/gdal/wiki/rfc21_ogrsqlcast
http://www.gdal.org/ogr/ogr_sql.html
Best regards,
Tamas
2008/8/4 Steve White <steve at online-archaeology.co.uk>:
> I'm trying to dump some tables out of MS SQL Server 2000 using a vrt file.
> The sql query includes a text field that could contain a large amount of
> characters.
>
>
>
> Here's my VRT file:
>
>
>
> <OGRVRTDataSource>
>
> <OGRVRTLayer name="Layer1">
>
> <SrcDataSource>MyDSN</SrcDataSource>
>
> <SrcSQL>EXEC MySP</SrcSQL>
>
> <FID>ID</FID>
>
> <GeometryType>wkbPoint</GeometryType>
>
> <LayerSRS>WGS84</LayerSRS>
>
> <GeometryField encoding="PointFromColumns" y="Latitude"
> x="Longitude"/>
>
> </OGRVRTLayer>
>
> </OGRVRTDataSource>
>
>
>
> I'm using org2ogr to produce a shapefile and it's all working fine. However,
> when I open the DBF file in Excel I see that the text field has been
> truncated at exactly 80 characters.
>
>
>
> I'm guessing that it's doing this by default because no explicit value has
> been set for the text field length.
>
>
>
> How can I specify a length for a text (string) field for my shp file when
> dumping out via ogr2ogr and a vrt file as above?
>
>
>
> Cheers,
>
>
>
> Steve
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
More information about the MapServer-users
mailing list