Marc,<br><br>Looks like there might be a problem with the targetSRS. Please check if it is ok. Try the exportToWkt method on it. Also, make sure the file pcs.csv in gdal's data directory contains the entry for 3577.<br>
<br><div class="gmail_quote">On Tue, Oct 18, 2011 at 3:41 PM, <span dir="ltr"><<a href="mailto:dev4cx4m9z@snkmail.com">dev4cx4m9z@snkmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-AU"><div><p class="MsoNormal" style="">I’m not sure the code will help too much, but here are the relevant code fragments. I’m using a hand crafted VB.net wrapper which explains some of the syntax<u></u><u></u></p>
<p class="MsoNormal" style=""><u></u> <u></u></p><p class="MsoNormal" style="">Private WGS84SRS As New OGRSpatialReference ' Coordinate system in WGS84<u></u><u></u></p><p class="MsoNormal" style="">Private MapSRS As OGRSpatialReference ' Coordinate system of map<u></u><u></u></p>
<p class="MsoNormal" style="">Private ctWGS84toMap As OGRCoordinateTransformation ' Coordinate transform from WGS84 to map<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="">With WGS84SRS<u></u><u></u></p>
<p class="MsoNormal" style=""> GDALError = .SetProjCS("WGS84 Datum")<u></u><u></u></p><p class="MsoNormal" style=""> Debug.Assert(GDALError = OGRError.OGRERR_NONE, GetLastErrorMsg())<u></u><u></u></p><p class="MsoNormal" style="">
GDALError = .SetWellKnownGeogCS("WGS84") ' Define WGS84 coordinate system<u></u><u></u></p><p class="MsoNormal" style=""> Debug.Assert(GDALError = OGRError.OGRERR_NONE, GetLastErrorMsg())<u></u><u></u></p>
<p class="MsoNormal" style="">End With<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="">With MapSRS<u></u><u></u></p><p class="MsoNormal" style=""> GDALError = .SetProjCS("Map coordinate system")<u></u><u></u></p>
<p class="MsoNormal" style=""> Debug.Assert(GDALError = OGRError.OGRERR_NONE, GetLastErrorMsg())<u></u><u></u></p><p class="MsoNormal" style=""> GDALError = .ImportFromEPSG(3577)<u></u><u></u></p><p class="MsoNormal" style="">
Debug.Assert(GDALError = OGRError.OGRERR_NONE, GetLastErrorMsg())<u></u><u></u></p><p class="MsoNormal" style="">End With<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="">ctWGS84toMap = GDAL.CreateCoordinateTransformation(WGS84SRS, MapSRS) ' Create a coordinate transformation - WGS84 to map<u></u><u></u></p>
<p class="MsoNormal" style="">Debug.Assert(ctWGS84toMap IsNot Nothing, GetLastErrorMsg())<u></u><u></u></p><div class="im"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="margin-bottom: 12pt;">Marc,<br>
<br>Can you provide the code leading to the error?<u></u><u></u></p></div><div><div class="im"><p class="MsoNormal">On Tue, Oct 18, 2011 at 1:21 PM, Marc Hillman <<a href="mailto:dev4cx4m9z@snkmail.com" target="_blank">dev4cx4m9z@snkmail.com</a>> wrote:<u></u><u></u></p>
</div><div><div><p class="MsoNormal">I have a GIS database, and all data is stored in WGS84 datum. I have developed an application using GDAL, and I now need to translate my WGS84 coordinates to several different datums, depending what map is loaded. I seem to be going around in circles, and need a nudge in the right direction. I am defining an OGRSpatialReference for each datum (WGS84 and current map) and then attempting to create an OGRCoordinateTransformation for the transformation.. This last step fails with a PROJ.4 error (“No PROJ.4 translation for destination SRS, coordinate transformation initialization failed”<u></u><u></u></p>
<div class="im"><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">My question is - Do I need PROJ.4 to do the translation? Can I not just use ImportFromWKT to define my OGRSpatialReference? If so, is there a nice canned list of all the WKT somewhere? I’m keen to avoid PROJ.4 if possible as I’m not sure I can build it.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p></div></div></div><div class="im"><p class="MsoNormal"><br>_______________________________________________<br>gdal-dev mailing list<br><a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><u></u><u></u></p></div></div><div class="im"><p class="MsoNormal"><br><br clear="all"><br>-- <br>
Best regards,<br>Chaitanya kumar CH.<br><br><a href="tel:%2B91-9494447584" value="+919494447584" target="_blank">+91-9494447584</a><br>17.2416N 80.1426E<br><br><u></u><u></u></p></div><p class="MsoNormal">No virus found in this message.<br>
Checked by AVG - <a href="http://www.avg.com" target="_blank">www.avg.com</a><br>Version: 2012.0.1831 / Virus Database: 2092/4558 - Release Date: 10/17/11<u></u><u></u></p></div></div><br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>
<br>+91-9494447584<br>17.2416N 80.1426E<br>