zhm / gdal-ruby

GDAL/OGR bindings for ruby
BSD 3-Clause "New" or "Revised" License
34 stars 10 forks source link

Gdal::Ogr.open returns Nil #10

Closed itsravenous closed 8 years ago

itsravenous commented 8 years ago

test.rb:

require 'gdal-ruby/ogr'

ds = Gdal::Ogr.open('./test.tif')
puts ds.nil?
$ ruby test.rb
True

test.tif is a GeoTIFF. We've successfully read test.tif with the node and python GDAL bindings, but would really like to use the ruby bindings in this instance.

The snippet from the README works, so GDAL appears to be loading ok.

$ ruby -e "require 'gdal-ruby/ogr'; puts Gdal::Ogr.create_geometry_from_wkt('POINT (30 10)').export_to_json"

{ "type": "Point", "coordinates": [ 30.0, 10.0 ] }
zhm commented 8 years ago

Sorry for the WAY delayed response, but I think you need to use the gdal module, not the ogr module:

require 'gdal-ruby/gdal'

ds = Gdal::Gdal.open('./test.tif')
puts ds.nil?