【问题标题】:number format shorten longitude and latitude?数字格式缩短经度和纬度?
【发布时间】:2012-06-13 21:19:02
【问题描述】:

orm 属性名称="poiLat" ormtype="big_decimal" notnull="true" persistent=true precision="16" scale="14"; 属性名称="poiLong" ormtype="big_decimal" notnull="true" persistent=true precision="16" scale="14";

由于超出属性上设置的长度,下面的输入会出错。如果值超过此值,我如何在 ColdFusion 中缩短值。

34.037864685058594

-118.27606201171875

local.poiEntity.setpoiLat(local.NewlatO);
local.poiEntity.setpoiLong(local.NewlonO);

【问题讨论】:

  • 您可以将经纬度存储为字符串还是必须对数字进行计算?
  • 我需要它们作为数字是的。我无法更改数据库长度。我需要在数据进入数据库之前以某种方式解析数据,确保它不超过这个值。我尝试过数字格式,但这不起作用

标签: coldfusion coldfusion-9


【解决方案1】:

好的,我想我有这个

round(local.NewlatO*10^6)/10^6;

这适用于 6 个地方

【讨论】:

  • 喜欢它...提出问题...自己回答以获得声誉。
  • 好吧,有人可能会告诉我这个 cal 是错误的,所以我留下来以防万一。我在 cf native 中看不到任何舍入函数,如果我错了,请纠正我。运行 cf9。
  • 是的...我打算使用格式函数建议 trim(numberformat(local.newlat,'___.000000')) 有点笨拙,但通常可以。
猜你喜欢
  • 2012-02-16
  • 1970-01-01
  • 2011-12-17
  • 2022-10-18
  • 1970-01-01
  • 1970-01-01
  • 2013-08-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多