11

Related to Data-type detection in ArcGIS table loading

I have a CSV file which contains a mixture of numeric and text fields:

ID,Txt,Int,Dbl
12345,abc,45,56.78
12346,9,65,23.12
12347,10,66,23.13

According to this Esri article if the top 8 rows contain a text value, the field will be classified as text, yet I am finding that the second field is classified as Long. This means that the value "abc" is omitted:

enter image description here

How can I force ArcMap to recognise this as a text field, while maintaining the data in CSV format?

A workaround will be to create a geodatabase table, define the field as text, and Load the data, but I'm hoping to keep the table in CSV (it's the output of another process).

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Aug 1, 2012 at 0:33
1

1 Answer 1

19

Have a look at the "Overriding how text files are formatted" section in the help topic on Adding an ASCII or text file table:

You can override how delimited text files are displayed within ArcGIS by using the schema.ini files. An example of when you would want to use the schema.ini file to override the default behavior is when ArcGIS is misinterpreting a field type. The following example shows how to do this for a field called PLOTS which should be displayed as type Text but is being interpreted as type Double.

[Trees.CSV]
Col14=PLOTS Text

Note that you may need to create a schema.ini file if one is not present and you need to override how delimited text files are displayed in ArcGIS. For more information on the schema.ini file, do a search for schema.ini on the Microsoft MSDN website.

answered Aug 1, 2012 at 0:54
3
  • 2
    Thanks for that - it does the trick. There seems to be a problem with ArcGIS scanning the first 8 rows automatically, though. Commented Aug 1, 2012 at 1:12
  • 4
    I had to add "MaxScanRows = 0" since the "ColX=name Text" thing didn't seem to work 100% on its own. Commented Sep 3, 2012 at 23:51
  • Has anyone tried this using arcpy on Linux? I'd guess that this would only work on Windows since schema.ini is all tied up with the Micrsoft ODBC cruft. Commented May 1, 2013 at 18:01

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.