Select to view content in your preferred language

Issue with arcpy Data Export: Double Field Loses Decimal Point

1472
7
10-24-2023 12:22 AM
Labels (3)
lmatteo
Occasional Contributor

Hello everyone,

I'm encountering a peculiar problem when exporting a feature class using the "Export Data" function (arcpy.conversion.ExportFeatures) in ArcGIS. The issue is as follows: after the export, a field of double type loses its decimal point, resulting in a loss of precision in the numbers. For instance, 320.7 becomes 3207 after the export.

I initially thought this could be related to a conversion from double to integer, but that's not the case. The decimal point is simply removed, and the values no longer correspond to what they should be.

Here's the arcpy command I'm using:

with arcpy.EnvManager(transferDomains="TRANSFER_DOMAINS", preserveGlobalIds=True):
arcpy.conversion.ExportFeatures(
in_features=inFC,
out_features=outFC,
where_clause="",
use_field_alias_as_name="NOT_USE_ALIAS",
field_mapping="",
sort_field=None
)

I'm puzzled as to the cause of this issue. Am I using the function incorrectly, or is this a bug in ArcGIS Pro? Have any of you encountered a similar problem and do you know how to resolve it?

Any assistance or suggestions would be greatly appreciated. Thank you in advance for your help.

Best regards,

0 Kudos
7 Replies
JohannesBierer
Frequent Contributor

Don't know exactly but if you work on a microsoft machine maybe check the regional system settings for decimal separator? It could be that it's not a point?

0 Kudos
lmatteo
Occasional Contributor

it's a comma in my system in the original layer, but this comma is missing in the output layer.
I've added two screenshots

0 Kudos
JohannesBierer
Frequent Contributor

Only a guess, could it be that for python the decimal separator has to be a point? What happens if you add a field with the same values and replace the comma to a point?

0 Kudos
lmatteo
Occasional Contributor

In that case, I should create a text field to change the comma into a point and thus, the dot won't disappear (text field and not double field)

0 Kudos
DanPatterson
MVP Esteemed Contributor

Export Features is a conversion tool.  What are you converting from and to?

Does Copy Features (Data Management)—ArcGIS Pro | Documentation

produce the same result if there is no type conversion?


... sort of retired...
lmatteo
Occasional Contributor

Copy Features does not convert my float number, so it's great. Anyway, I can not remove fields at the same time while creating new layer (it's possible to select fields with the Export Features function).

0 Kudos
DanPatterson
MVP Esteemed Contributor

If memory serves, go into the fields view in the table and hide those that you don't want copied over


... sort of retired...
0 Kudos