[Gdal-dev] Using OSR methods from bindings

Ari Jolma ari.jolma at tkk.fi
Tue Jun 20 03:31:53 EDT 2006


This is Perl but the case should be similar for all swig languages. This 
is the beginning of my review of the OSR methods in the swig interface.

> print $srs->GetLinearUnits()
> 1
>   

The returned value is the value to multiply by linear distances to 
transform them to meters. In this case the linear units are meters, so 
the multiplication factor is 1.

> print $srs->SetLinearUnits("mi")
> RuntimeError Usage:
> SpatialReference_SetLinearUnits(self,name,to_meters);
>   

There is a bug in the bindings: SetLinearUnits calls SetAngularUnits. 
When this is fixed, the call is for example: 
$srs->SetLinearUnits($osr::SRS_UL_FOOT, $osr::SRS_UL_FOOT_CONV)

> p osr::GetWellKnownGeogCSAsWKT($osr::SRS_PT_ALBERS_CONIC_EQUAL_AREA)
> (null return)
>   
I suspect $osr::SRS_PT_ALBERS_CONIC_EQUAL_AREA, which is the string 
'Albers_Conic_Equal_Area' is not a valid argument. For example

print osr::GetWellKnownGeogCSAsWKT('EPSG:4326'),"\n";

Returns a valid WKT.

-- 
Prof. Ari Jolma
Kartografia ja Geoinformatiikka / Cartography and Geoinformatics
Teknillinen Korkeakoulu / Helsinki University of Technology
tel: +358 9 451 3886 address: POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma




More information about the Gdal-dev mailing list