使用geom postgis适配器

时间:2014-04-07 18:19:42

标签: ruby-on-rails gem postgis

添加多边形?

local = Local.new(:geom => **Polygon('-71.1776585052917 42.3902909739571,-71.1776820268866 42.3903701743239,-71.1776063012595 42.3903825660754')**)

错误:语法错误,意外tFLOAT,期待'>'

1 个答案:

答案 0 :(得分:0)

构建多边形:

Polygon.from_coordinates([[[-71.1776585052917,42.3902909739571],[-71.1776820268866,42.3903701743239],[-71.1776063012595,42.3903825660754],[-71.1776585052917,42.3902909739571]]], 4326)

确保外部线性环闭合(即三角形有四个点)。我也设置了一个SRID = 4326,猜测你正在使用WGS 84。