RGeo为POINT特征提供内置方法,例如getter方法lat()和lon()从POINT对象中提取纬度和经度值.不幸的是,这些不适合作为制定者.例如:
point = RGeo::Geographic.spherical_factory(:srid => 4326).point(3,5) // => #<RGeo::Geographic::SphericalPointImpl:0x817e521c "POINT (3.0 5.0)">
我可以做这个:
point.lat // => 5.0 point.lon // => 3.0
但我做不到:
point.lat = 4 // => NoMethodError: undefined method `lat=' for #<RGeo::Geographic::SphericalPointImpl:0x00000104024770>
有关如何实现setter方法的任何建议?你会在模型中扩展还是扩展Feature类?
@H_502_14@