Pregunta

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?

¿Fue útil?

Solución

Try

path = File.join(Rails.root, 'lib/tasks/filename.shp')
factory = Region::GEOFACTORY
RGeo::Shapefile::Reader.open(path, :factory => factory)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top