Archive for June, 2006

taking GDAL/OGR ruby bindings for a spin 0

Since i have volunteered to write the gdal ruby-binding test cases i thought it would be a good time to try out some of the ogr ruby-bindings. Charlie Savage has done a lot of work on the gdal SWIG ruby biniding and already written the test suite for OGR. Thanks to his excellent instructions on how to get started with writing the gdal-ruby test suit i was able to to easily convert Ari Jolma’s dumpall.pl to a ruby script to dump the contents of ogr (Vector) datastore.

require 'gdal/ogr'
 
@global_extent = Array.new#(4, 0.0)
 
def dump_geom(geom, v)
  print "  Geometry type: ", geom.get_geometry_type, "\n"
  print "  Geometry name: ", geom.get_geometry_name, "\n" 
  extent = geom.get_envelope
  print "  BBox: ", extent[0], " ", extent[2], " ", extent[1], " ", extent[3], "\n" 
  for i in [0, 2]
    if (@global_extent[i].nil?) or @global_extent[i] > extent[i]
      @global_extent[i] = extent[i] 
    end
  end
  for i in [1, 3]
    if (@global_extent[i].nil?) or @global_extent[i] < extent[i]
      @global_extent[i] = extent[i] 
    end
  end
  if (geom.get_geometry_count > 0) 
    print "Geom Count = ", geom.get_geometry_count, "\n"
    geom.get_geometry_count.times do |i|
      dump_geom(geom.get_geometry_ref(i),v)
    end
  else
    if(!v)
      print "PointCount: ", geom.get_point_count,"\n" 
      geom.get_point_count.time do |i| 
      x = geom.get_x(i)
      y = geom.get_y(i)
      z = geom.get_x(i)
      print  " ",  x, " ", y, " ", z, "\n";
      end 
    end
  end
end
 
def dump_feature_data(feature, layer)
  feature_defn = layer.get_layer_defn  
  print "Feature ID: ", feature.get_fid, "\n"
  feature_defn.get_field_count.times do |i|
    print "Field ", i+1, "\n"
    field_defn = feature_defn.get_field_defn(i)
    print "  Field name: ",field_defn.get_name_ref,"\n" 
    type = field_defn.get_type
    print "  Field type: ", field_defn.get_field_type_name(type)," type\n"
    field = feature.get_field_as_string(i);
    print "  Field value: ", field,"\n"
  end
end
 
def dump_layer(layer)
  layer.reset_reading
  layer.get_feature_count.times do |i|
    feature = layer.get_feature(i)
    dump_feature_data(feature, layer)
    geom = feature.get_geometry_ref()
    do_not_show_vertices = 1
    if not geom.nil?
      dump_geom(geom, do_not_show_vertices)
    elsif geom.nil?
      print "*** expected geometry but got nill\n"
    end
end
end
 
if ARGV.length < 1
  print "Usage:  #$0", " <input_file>\n"
  exit
else
  filename = ARGV[0]
end
# driver = Gdal::Ogr.get_driver_by_name('ESRI Shapefile')
# open file as a OGR dataset
dataset = Gdal::Ogr.open(filename)
print "Looking at ", filename + " ...\n"
# get the number of layers
layer_num = dataset.get_layer_count 
layer_num.times do |i|
  layer = dataset.get_layer(i)  
  print "  looking at layer num: ", i+1 , "\n",
  "  Name: "+layer.get_name + ", Features: "+ layer.get_feature_count.to_s + "\n"
  dump_layer(layer)
end

A pleasent surprise 1

I noticed a link to High Earth Orbit on my dashboard today. Thanks for the encouragement  Andrew.

FOSS4G’06 Abstract Submit deadline 0

http://www.foss4g2006.org/conferenceCFA.py?confId=1

Geo-Delivery in action 0

Yes i know that looks like ArcGIS… that’s because it is. I did a screen cast of what we (Minh & myself) have manged to complete of the WCS client its far from finished. The image below is from the part where i opened the downloaded data in ArcGIS to process.
Enjoy this for now, more details about the release date as we get more time …

Metacafe Screencast in case you can’t see YouTube /

CoastGIS06 — Paper Due 0

http://www.uow.edu.au/science/eesc/conferences/coastabs.html

PostGIS for the python folks 0

Richard Taylor has release an update to GeoType — a python library that implements OGC Simple Features Specification and PostGIS geometry in Python. It has integration with Psycopg & python-postgresql interface. This ones for you gus ;)

GeoTypes

Map24 API is now free! 0

When i read the news regarding the Map24 API now being free — i couldn’t wait to get my developers key… making my way to their website i actually decided to read the blurb above the shiny ‘Get API Key’ button, it said they may advertise on the map and the page-hits are limited to 10,000 per API key. The reason i am so excited about this api is coz of its support for Routing, Geocoding and Perspecive View… Geocoding is only just emerging in googlemaps and routing is still missing for Melbourne. Mind u i couldn’t get it to work from my brief use of api for melbourne either… but that’s probably my bungling up… will look at it again when i have more time.

Map24 Deveoplers Site