<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
span.plaintextchar0
        {mso-style-name:plaintextchar;
        mso-style-priority:99;
        font-family:Consolas;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Arial","sans-serif";
        color:navy;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:1.0in 69.6pt 1.0in 69.6pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Gary,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Can you send me the projection definition (string) and I will see
if it works on my box. I’m not sure what you get when you download Frank
Tools because I always just get the source code but see if you can find a file
named “prime_meridian.csv”. That would be the data dir. Are you
building gdal from source or does Frank Tools come with a gdal1x.dll already
there? If you are not building from source then maybe you don’t need the
proj4 nad files. I think you do though because usually when the transformation
init fails it’s because it can’t find those files or the files are
from a different version. Sorry if I’m not being much help. </span><span
style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Martin <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
gdal-dev-bounces@lists.osgeo.org [mailto:gdal-dev-bounces@lists.osgeo.org] <b>On
Behalf Of </b>Smart, Gary<br>
<b>Sent:</b> Monday, July 20, 2009 8:50 AM<br>
<b>To:</b> gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> RE: [gdal-dev] Converting raster pixel space to geospace<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:navy'>Thanks Martin, but now to the next problem…<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:navy'><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:navy'>I downloaded PRROJ.4 which seemed to configure and compile OK.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:navy'>Having set the PROJ_LIB as you proposed, I now get:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:navy'><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:navy'>ERROR 1: No PROJ.4 translation for source SRS, coordinate
transformation initialization has failed.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:navy'><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:navy'>I guess I am still missing comething. The failure came from
the same geotiff file as below.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:navy'><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:navy'>I also couldn’t find a ‘data dir’ in the GDAL
source and therefore GDAL_DATA env var remained unset. We installed
everything from the FWTools download for our Linux SUSE10 system. Should
there be a ‘data’ directory under the FWTools directory
somewhere? There is no GDAL source in this directory – just include
files and libraries. I presumed this was all that was needed to use
GDAL? <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:navy'><o:p> </o:p></span></p>
<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>
<div>
<div class=MsoNormal align=center style='text-align:center'>
<hr size=2 width="100%" align=center>
</div>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Martin Chapman
[mailto:chapmanm@pixia.com] <br>
<b>Sent:</b> 20 July 2009 14:49<br>
<b>To:</b> Smart, Gary; gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> RE: [gdal-dev] Converting raster pixel space to geospace</span><o:p></o:p></p>
</div>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Gary,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Set your paths like such on startup or as an environment
variable:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:#A31515'>GDAL_DATA points at the data dir that comes with gdal source.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:#A31515'>PROJ_LIB point to the nad directory that you download from proj4
website.</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>string env = string(<span style='color:#A31515'>"GDAL_DATA="</span>)
+ dataPath;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>_putenv(env.c_str());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>env = string(<span style='color:#A31515'>"PROJ_LIB="</span>)
+ nadPath;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>_putenv(env.c_str());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>and / or<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>CPLSetConfigOption(<span style='color:#A31515'>"GDAL_DATA"</span>,
dataPath.c_str());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>CPLSetConfigOption(<span style='color:#A31515'>"PROJ_LIB"</span>,
nadPath.c_str());<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Martin<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
gdal-dev-bounces@lists.osgeo.org [mailto:gdal-dev-bounces@lists.osgeo.org] <b>On
Behalf Of </b>Smart, Gary<br>
<b>Sent:</b> Monday, July 20, 2009 7:38 AM<br>
<b>To:</b> gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> RE: [gdal-dev] Converting raster pixel space to geospace<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoPlainText><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>OK - I can get it to compile and not
crash instantly (bonanza!)<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>However, when I try to create the OGR
transform using importFromWkt, <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>I get the following:<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>ERROR 6: Unable to load PROJ.4 library
(libproj.so), creation of<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>OGRCoordinateTransformation failed.<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>Does anyone know what this means?
Is there some part of OGR/GDAL I have yet to install?<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>My input projection is:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>GTiff/GeoTIFF
Projection
PROJCS["TM
D-01",GEOGCS["NAD27",DATUM["North_American_Datum_1927",SPHEROID["Clarke
1866",6378206.4,294.9786982139006,AUTHORITY["EPSG","7008"]],AUTHORITY["EPSG","6267"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4267"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-124.5],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]]]<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>...and I am looking to output WGS84
lat/longs.<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> </span>-----Original Message-----<span
lang=EN-GB><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> </span>From: Even Rouault
[mailto:even.rouault@mines-paris.org]<span lang=EN-GB><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> </span>Sent: 16 July 2009 19:44<span
lang=EN-GB><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> </span>To: Smart, Gary<span
lang=EN-GB><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> </span>Cc: gdal-dev@lists.osgeo.org<span
lang=EN-GB><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> </span>Subject: Re: [gdal-dev]
Converting raster pixel space to geospace<span lang=EN-GB><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> Le Thursday 16 July 2009 10:41:02
Smart, Gary, vous avez écrit :<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> ><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> > But how do I load a
OGRSpatialRef object with the output from the<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> > GDALApplyGeoTransform?
Presumably I can prime the OGRSpatialReference<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> > using the result of
GDALDataset::GetProjectionRef?<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> Yes, almost. See below<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> > I'm not yet sure of my<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> > terminology but is the
GetProjectionRef supposed to satisfy the OGR<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> > importFromWkt (the types seem
to clash though - char* vs char**)?<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> Maybe the doc of
OGRSpatialReference::importFromWkt() (see<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>>
http://gdal.org/ogr/classOGRSpatialReference.html#b74cfc985bd05404a4c61d2d<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> 633a6343)<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> isn't clear enough ? I must confess
that the prototype is a bit weird. You<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> don't pass the string itself, but a
pointer to a string. The pointer will<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> be<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> modified to point to the remaining
(unused) input, what you generally<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> don't<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> care about.<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> Ok, here's a sample snippet :<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> OGRSpatialReferenceH hSRS =
OSRNewSpatialReference(NULL);<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> const char* pszWkt =
GDALGetProjectionRef(hDS);<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> OSRImportFromWkt(hSRS, (char**)
pszWkt);<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> (For the purists, a more correct
prototype of importFromWkt () would have<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> relied on 'const char**' to avoid
the above cast)<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> But a simpler approach would be
just :<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> OGRSpatialReferenceH hSRS;<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> hSRS =
OSRNewSpatialReference(pszWKT);<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> which instanciates the
OGRSpatialReferenceH object and call internally<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> importFromWkt()<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> ><o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> > I suspect my output projection
could then be set up with<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> >
SetWellKnownGeogCS("WGS84") in order to convert from whatever input<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> > projection prevails, to a
standard WGS84 lat/long representation (using<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> >
OGRCreateCoordinateTransformation::Transform)?<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> Yes. Actually, it will be long/lat
in term of the order of the<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> coordinates.<o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB>> <o:p></o:p></span></p>
<p class=MsoPlainText><span lang=EN-GB><o:p> </o:p></span></p>
</div>
</div>
</body>
</html>