相关疑难解决方法(0)

Rails:从MySQL转换为PostGres打破了Geokit距离计算?

我最近将我的数据库从MySQL切换到PostGres.我也使用GeoKit.当我使用已经播种的新数据库启动我的应用程序时,我收到以下错误:

PGError: ERROR:  function radians(character varying) does not exist
LINE 1: ...COS(0.661045389762993)*COS(-2.12957994527573)*COS(RADIANS(ti...
                                                         ^
HINT:  No function matches the given name and argument types. You might 
need to add explicit type casts.
Run Code Online (Sandbox Code Playgroud)

任何人都知道为什么现在这会破裂?我知道GeoKit仍然有效,因为当数据库被播种时,它仍然在每张票的模型中执行地理编码,它只是不能正确地进行距离计算.

postgresql plugins ruby-on-rails geokit

2
推荐指数
1
解决办法
1111
查看次数

为什么Postgresql会像Geokit这样失败?

我刚刚开始使用Rails为我正在构建的应用程序玩geokit.我的记录得到了地理编码,但是当我进入控制台看看我能用它做什么时它会爆炸以下内容:用户是我的数据库中带有lat和lng的用户对象

>> Restaurant.find(:all, :origin => user) 

  Restaurant Load (0.0ms)   PGError: ERROR: operator does not exist: 
numeric - character varying 
LINE 1: ...*, SQRT(POW(111.1819*(-33.872517-restauran... 
 ^ 
HINT: No operator matches the given name and argument type(s). You 
might need to add explicit type casts. 
: SELECT *, SQRT(POW(111.1819*(-33.872517-restaurants.lat),2)+ 
 POW(76.7136337302943*(151.205536-restaurants.lng),2)) 
 AS distance FROM "restaurants" 
ActiveRecord::StatementInvalid: PGError: ERROR:  operator does not 
exist: numeric - character varying 
LINE 1: ...*,                   SQRT(POW(111.1819*(-33.872517- 
restauran... 
                                                             ^ 
HINT:  No operator matches the given name and argument type(s). You 
might …
Run Code Online (Sandbox Code Playgroud)

postgresql ruby-on-rails geokit

1
推荐指数
1
解决办法
939
查看次数

标签 统计

geokit ×2

postgresql ×2

ruby-on-rails ×2

plugins ×1