Skip to main content
Solved

Having a problem with data type 'double' when fme is writing shapefiles


nicholass
Participant
Forum|alt.badge.img+1

Hi all,

I work on a mapping project that requires all of our shapefiles to be quality checked at the end of production. I currently have an FME workbench that converts Esri geodatabases to shapefiles for the final check.

However, I’m having an issue with one of my attributes. The attribute is being written out by the workbench as a ‘double’ (which I believe has a max width of 19). The quality check tool checks both the data type (needs to be real) and the specified width of each attribute (needs to be 19).

When it is checked by the quality check tool I get an error message which states the expected length is 19 and has found a width of 15? It’s fine with it being a ‘double’ though?

Any ideas?

Will provide more information if needed.

Best answer by takashi

Hi ​@nicholass ,

In fact, Shapefile format doesn't support general numeric data types such as 'short', 'long', 'float', 'double', etc., only supports 'number(width,precision)'. The type name 'double' in FME Shapefile writer feature type is just an alias of 'number(31,15)'.

I'm not sure if the desirable maximum width for 'double' type is 19, but you can explicitely specify width and precision of a destination numeric type column with 'number(width,precision)' format in Shapefile writer feature type User Attributes tab, if necessary.

View original
Did this help you find an answer to your question?

3 replies

takashi
Supporter
  • Best Answer
  • April 4, 2025

Hi ​@nicholass ,

In fact, Shapefile format doesn't support general numeric data types such as 'short', 'long', 'float', 'double', etc., only supports 'number(width,precision)'. The type name 'double' in FME Shapefile writer feature type is just an alias of 'number(31,15)'.

I'm not sure if the desirable maximum width for 'double' type is 19, but you can explicitely specify width and precision of a destination numeric type column with 'number(width,precision)' format in Shapefile writer feature type User Attributes tab, if necessary.


nicholass
Participant
Forum|alt.badge.img+1
  • Author
  • Participant
  • April 4, 2025

Hi ​@takashi,

Thanks for your response.

I had already tried this. I used ‘number(19,0)’. It solved the length error issue. However, I was then getting an error which states that it was expecting ‘real’ but found ‘integer’. 

I have now tried again. However, this time I tried ‘number(19,15)’ it seems that also specifying a precision (albeit a random one) has fixed my issue.

I am defiantly not technically competent enough to suggest a reason why this worked. I just hope that it does not truncate any values.

 


takashi
Supporter
  • April 4, 2025

'precision' in data type 'number(width,precision)' means the maximum number of decimal places, and FME Shapefile Reader/Write treats 'number(w,0)' as an integer type, treats 'number(w,p)' (0 < p) as a real  type.

For example, 'number(5,2)' means 'a real number whose entire length (including decimal point and negative sign) is 5 or less and also the number of decimal places is 2 or less. A field with this type can store these numbers

  • 1.23
  • 12.34
  • 123.4
  • 12345

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings