Changes between Initial Version and Version 1 of WikiStart/Ruby/Georeference


Ignore:
Timestamp:
04/08/11 17:59:19 (9 years ago)
Author:
sylvain.joyeux
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart/Ruby/Georeference

    v1 v1  
     1You need to install GDAL/Ruby 1.8 bindings. 
     2 
     3On Debian/Ubuntu: 
     4 
     5{{{ 
     6sudo apt-get install libgdal-ruby1.8 
     7}}} 
     8 
     9Example script, to convert from lat/long in WGS84 into UTM coordinates 
     10 
     11{{{ 
     12require 'gdal/osr' 
     13from = Gdal::Osr::SpatialReference.new 
     14from.set_well_known_geog_cs('WGS84') 
     15to   = Gdal::Osr::SpatialReference.new 
     16to.set_well_known_geog_cs('WGS84') 
     17to.set_utm(32, 1) # UTM band 32, north 
     18 
     19transform = Gdal::Osr::CoordinateTransformation.new(from, to) 
     20}}} 
     21 
     22Then, you can do the convertion with 
     23 
     24{{{ 
     25x, y, z = transform.transform_point(longitude, latitude, altitude) 
     26}}}