[gdal-dev] Asking about feature field types of Shape File (SHP) ?

Jan Heckman jan.heckman at gmail.com
Mon Jun 16 12:44:36 PDT 2014


Not focusing on ogr, but on shapefile:
Shapefile uses .dbf (dBase III) to store attributes (except geometrical
attributes which are stored in the .shp file).
This format does not know about integers, only about numericals (type N or
F), with a specifiable precision (how many number-positions) and number of
decimals (behind the decimal separator), aka scale.
If this sounds textish, that is because it is: the numbers are stored in
the file as text. N as a fixed point double, F - in principle, but in fact
depending on implementation - uses scientific notation. When specifying
these values (when creating a field), you typically count the non-numerical
parts such as a - sign, the decimal separator and the exponent when using F
to specify precision. Exponent, by default, but hard to change, uses 3
digits, and E and possibly a - (negative exponent).
I hope that explains why there is not an effective type Integer for
shapefiles. There is no way for a (ogr)driver to invent one in the case of
 shapefiles. The type integer is applicable by extension because in  other
formats the distinction between numerical types is maintained more
rigorously. Number of decimals = 0 should do the trick, but ArcGis will
call it a double with some precision and scale 0. Can be used as integer
without side-effects, so far I've noticed.
Jan


On Mon, Jun 16, 2014 at 5:05 PM, Ari Jolma <ari.jolma at gmail.com> wrote:

> On 06/04/2014 11:45 PM, taibc wrote:
>
>> Hi everyone,
>>
>> I created the shape file by usinge the feature filed type: OFTInteger.
>>
>> But when I open the file in Arcgis (ArcCatalog) the data type is: Double
>> (not integer).
>>
>> Do you know how to fix this (I want it is Int) ?
>>
>
> Dear Tai,
>
> This is a bit old email so I'll answer from my head. I believe you need to
> set the length of the Integer field to be short enough. If I remember
> correctly there is a ticket on the issue, but it is deemed as a feature,
> not a bug.
>
> Ari Jolma
>
>
>> Thanks and regards,
>> Tai
>>
>>
>>
>> --
>> View this message in context: http://osgeo-org.1560.x6.
>> nabble.com/Asking-about-feature-field-types-of-Shape-
>> File-SHP-tp5144127.html
>> Sent from the GDAL - Dev mailing list archive at Nabble.com.
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140616/49706df9/attachment.html>


More information about the gdal-dev mailing list