Write floating point value to SDE/PostGIS

467
4
11-11-2011 01:21 AM
BerendVeldkamp
Occasional Contributor II
Hi,

I'm trying to insert a new row into an SDE/PostGIS database, using Python. The field is defined as numeric(38,8) in PostgreSQL, and as double in ArcCatalog. The decimal symbol in windows' language settings is set to '.'

Here's some sample code:
featureClass = "Database Connections\Connection to sde\sde.schema.featureclass"
rows = arcpy.InsertCursor(featureClass)
row = rows.newRow() 
row.value = 1.88
rows.insertRow(row)
This results in a value '1' in the table. I also tried float(1.88) and '1.88' but these also result in 1. Setting the value to '1,88' results in 188.

How can I solve this?

Best regards,
Berend Veldkamp
Tags (2)
0 Kudos
4 Replies
AntonioSergio
Esri Contributor
Hi Berend,

I'm having the same problem!

How you solve that?

Best Regards,

António Sérgio
0 Kudos
BerendVeldkamp
Occasional Contributor II
Hard to say, one year afterwards 😉

I seem to remember we never found a fix, but decided to ignore it because the decimals weren't significant anyway (in our case).
I would suggest you contact you local ESRI representative, it might be a bug. Who knows?
0 Kudos
AntonioSergio
Esri Contributor
Thanks Berend
0 Kudos
AntonioSergio
Esri Contributor
Hi Berend,

We made some tests and it seems that the problem is from ArcGIS Desktop side: if we change the Desktops Windows 7 Regional Settings from Portuguese (Portugal) format  to English (United States), the decimal part of numbers is displayed,

Best Regards,

António Sérgio
0 Kudos