1

I'm trying to create a feature class from a csv / tab delimited file. All the fields in the file are numeric, but some have null values, and those fields are being coerced into "text" types. (actually, only the SECOND time I run the create XY layer. The first time it's fine, and it's fine if I delete Scheme.ini). Any advice for a workaround?

  • 1
    Edit the schema.ini file to correctly interpret the csv(s) instead of relying on it to auto-create the ini file for you. – John May 5 '14 at 18:01
1

The result of this operation will depend upon if you are creating a shapefile or a feature class inside a geodatabase. This is important because there are distinctions between the two of how they deal with null values. Specifically columns in .shp files don't allow numeric nulls while columns in feature classes, i.e. within a geodatabase, do. This could have an influence on why your operation does not run properly, or rather get the result you are hoping for.

| improve this answer | |
0

Working directly from text or Excel causes this problem to occur frequently. If you have Microsoft Access (or similar in OpenOffice) then use that to import to cleaner numbers. That way you can specify the field type (not just numeric but Int/floating).

Create a personal geodatabase in catalog, this creates an Access (Jet) database with all the tables for ESRI to understand what it's about. Open it in Access (or equivalent) and import the table... you can then create feature class from XY table using the GeoDatabase table instead of the CSV.

Before you make your feature class you can find the NULL values in the database table and replace with a value that is known to be nothing (good examples are -9999, 65535 depending on your data type) so that when you look at the result and see those values you know that they are tokens for no data supplied and not a genuine 0.

Of course you could skip the geoprocessing altogether and create the geometries by reading the file line by line from chapter 7.2 then string.split to a list and create and store the geometries using an insert cursor. Then you can decide pythonically what to do with null (empty) values i.e. len() == 0.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.