小编Lar*_*rry的帖子

如何转换Shapefile的坐标?

我正在尝试将邻居数据存入我的应用程序,并且我遇到了我正在使用的数据的问题,我从这里得到了这些数据.

此文件包含具有旧金山邻域的shapefile.我正在运行Ruby on Rails框架,我目前正在使用GeoRuby来解析shapefile.

代码如下所示:

def self.run_import
  shpfile = '/path/to/realtor_neighborhoods/realtor_neighborhoods'
  ShpFile.open(shpfile) do |shp|
    shp.each do |shape|
      # This gets the first (and only) Polygon from each MultiPolygon
      polygon = shape.geometry.geometries.first 
      puts polygon.inspect
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

代码能够解析文件,但我无法理解解释的坐标.对于有效的纬度和经度,当我期望坐标在-180和180之间时,所有点都具有数百万的值.看一个示例点:

<GeoRuby::SimpleFeatures::Point:0x00000104566a08 @srid=4326, @with_z=false, \
   @with_m=false, @x=6015402.9999795845, @y=2114960.4999904726, @z=0.0, @m=0.0>,
Run Code Online (Sandbox Code Playgroud)

这些坐标值的格式是什么?如何将它们转换为对我有意义的值?(即基于SRID 4326 <=> WGS84空间参考系统的纬度/经度)

先感谢您!

ruby gis postgis ruby-on-rails shapefile

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

标签 统计

gis ×1

postgis ×1

ruby ×1

ruby-on-rails ×1

shapefile ×1