문제

I have a file I'm trying to open in a Rails application. For some reason Ruby is splitting the name of the file.

For example:

root = Rails.root
path = root.join('lib/tasks/filename.shp')
puts path

What is output is /lib/tasks/filename/shp.

Then I run the command:

factory = Region::GEOFACTORY
RGeo::Shapefile::Reader.open(path, :factory => factory) do |file|

I get the error message:

Errno::ENOENT: No such file or directory - /lib/tasks/filename/.shp

It looks like the file has been split into filename and .shp?

도움이 되었습니까?

해결책

Try

path = File.join(Rails.root, 'lib/tasks/filename.shp')
factory = Region::GEOFACTORY
RGeo::Shapefile::Reader.open(path, :factory => factory)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top