[Gdal-dev] Re: ruby examples?

Akio Takubo takubo at saruga-tondara.net
Mon Mar 6 12:00:32 EST 2006


Dear list,

 I'm new to Gdal ruby binding and playing with it. I tried to write 
reading part of Gdal tutorial's example in ruby(please see attached file).
 As writing ruby's tutorial, I found two questions(problems?).

 1. No way for releasing dataset?
 When using C++ or C, we can release dataset easily by calling destructor 
or GdalClose(). In ruby binding, is there a way to release dataset 
expect for exiting script?

 2. variable aruguments
 Some method has variable arguments example for Gdal::Gdal::Band#read_raster, 
I think. But I can't pass optional arguments at all. I called read_raster 
like python's example. 
 band.read_raster(0, 0, band.xsize(), 1, band.xsize(), 1)
But I got following error.
 in `read_raster': in method 'ReadRaster', argument 8 of type 'int *' (TypeError)
My syntax is wrong? or gdal/ruby's issue?

 Now I'm using cvs snapshot(2006-02-18). If newer version has some improvement 
or modification, I'll try it.

Thanks,

On Sat, 04 Mar 2006 03:04:57 -0700
Charlie Savage <cfis at interserv.com> wrote:

> Hi guys,
> 
> Let me know what issues you run into on the GDAL side since its not well 
> tested (actually, its not tested at all!).  If you have the time (or 
> anyone else out there), extending the test suite for GDAL would be 
> great.  All I've been doing is porting the Python Unit tests to Ruby - 
> its pretty easy, just a bit time consuming.  Anyway, I'd be happy to get 
> any updated tests checked in and any issues that they turn up fixed.
> 
> On the other hand, the OGR and OSR bindings should work well and are 
> well tested.
> 
> Thanks,
> 
> Charlie
> 
> Ken-ichi wrote:
> > Ah, awesome.  I didn't know about gdalautotest, but, like you said, 
> > plenty of goodies.  For the record and for future Ruby nubies like 
> > myself, opening a GDAL dataset looks something like this:
> > 
> > require 'gdal/gdal'
> > dataset = Gdal::Gdal.open('filename.ext')
> > 
> > I haven't done much else with it yet, but I'll probably be back to 
> > report any major problems I have.
> > 
> > Thanks again!
> > 
> > Ken-ichi Ueda
> > Kelly Research and Outreach Lab (http://kellylab.berkeley.edu)
> > University of California, Berkeley
> > Environmental Science, Policy, and Management
> > Berkeley, CA 94720
> > tel: 510.642.8322
> > fax: 510.642.1477
> > e-mail: kueda at nature.berkeley.edu
> > 
> > 
> > 
> > s duclos wrote:
> >> Hi Ken-ichi,
> >>
> >> This answer from  Charlie Savage
> >> got me started:
> >>
> >> http://lists.maptools.org/pipermail/gdal-dev/2005-December/007362.html
> >>
> >>
> >>
> >> Sylvain.
> >>
> >> --- Ken-ichi <kueda at nature.berkeley.edu> wrote:
> >>
> >>  
> >>> Hi all.
> >>> I'm trying to figure out how to use the Ruby
> >>> bindings in GDAL, but I can't seem to find any examples out there for 
> >>> even
> >>> the most basic things, like setting all the constants.  The GDAL
> >>> API Tutorial on gdal.org seems to have great docs for C, C++, and
> >>> Python, but nothing for Ruby.  Can anyone provide some basic examples of
> >>> how to open a file, etc?  I've gotten about as far as
> >>>
> >>> require 'gdal/gdal'
> >>> require 'gdal/gdalconst'
> >>>
> >>> but that's about it.
> >>>
> >>> -- 
> >>> Ken-ichi Ueda
> >>> Kelly Research and Outreach Lab
> >>> (http://kellylab.berkeley.edu)
> >>> University of California, Berkeley
> >>> Environmental Science, Policy, and Management
> >>> Berkeley, CA 94720
> >>> tel: 510.642.8322
> >>> fax: 510.642.1477
> >>> e-mail: kueda at nature.berkeley.edu
> >>>
> >>> _______________________________________________
> >>> Gdal-dev mailing list
> >>> Gdal-dev at lists.maptools.org
> >>> http://lists.maptools.org/mailman/listinfo/gdal-dev
> >>>
> >>>     
> >>
> >>
> >> __________________________________________________
> >> Do You Yahoo!?
> >> Tired of spam?  Yahoo! Mail has the best spam protection around 
> >> http://mail.yahoo.com   
> 
> 
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev
> 

-- 
    Akio Takubo    from Tokyo, Japan
	takubo at saruga-tondara.net
===================================================


-------------- next part --------------
A non-text attachment was scrubbed...
Name: tutorial.rb
Type: application/octet-stream
Size: 1356 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060307/d1f7f77e/tutorial.obj


More information about the Gdal-dev mailing list