<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<div>Hello,</div>
<div><br>
</div>
<div>I've been browsing the manuals, and cannot find any reason why cs2cs and the sample C++ program behave differently:</div>
<div><br>
</div>
<div>> echo "25w 60n" | /usr/proj70/bin/cs2cs -f "%.8f" +from +init=epsg:4326 +to +init=epsg:4326 +lon_wrap=180</div>
<div>335.00000000 60.00000000 0.00000000</div>
<div><br>
</div>
<div>> g++ -std=c++11 -o tese tese.cpp -I/usr/gdal30/include -L/usr/gdal30/lib -lgdal</div>
<div>> ./tese</div>
<div>Warning 1: +init=epsg:XXXX syntax is deprecated. It might return a CRS with a non-EPSG compliant axis order.</div>
<div>x=-25 y=60</div>
<div><br>
</div>
<div>It seems to me based on browsing the source code that both call proj_trans, and hence should probably produce</div>
<div>the same results. I couldn't debug any further with the RHEL7 RPM packages since the pgdg repo does not</div>
<div>provide the necessary debuginfo packages for GDAL or PROJ (would be nice to have them for perf too).</div>
<div><br>
</div>
<div>The +lon_0 option seems to work just fine for metric projections, but does not work for geographic conversions</div>
<div>such as this one.</div>
<div><br>
</div>
<div>Is there a good reason for the discrepancy which I may have missed, or should this perhaps be considered a bug?</div>
<div><br>
</div>
<div>Regards,</div>
<div><br>
</div>
<div>Mika Heiskanen</div>
<div><br>
</div>
<div><br>
</div>
<div>[-] = =tese.cpp------------------------------------------------------------------------------------------------------------------------------------------------------------------</div>
<div>#include <ogr_spatialref.h>                                                                                                                                                      </div>
<div>#include <iostream>                                                                                                                                                              </div>
<div>                                                                                                                                                                                 </div>
<div>int main()                                                                                                                                                                       </div>
<div>{                                                                                                                                                                                </div>
<div>  OGRSpatialReference source;                                                                                                                                                    </div>
<div>  source.SetFromUserInput("epsg:4326");                                                                                                                                          </div>
<div>  source.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);                                                                                                                     </div>
<div>                                                                                                                                                                                 </div>
<div>  OGRSpatialReference target;                                                                                                                                                    </div>
<div>  target.SetFromUserInput("+init=epsg:4326 +lon_wrap=180");                                                                                                                      </div>
<div>  target.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);                                                                                                                     </div>
<div>                                                                                                                                                                                 </div>
<div>  auto* trans = OGRCreateCoordinateTransformation(&source, &target);                                                                                                             </div>
<div>                                                                                                                                                                                 </div>
<div>  double x = -25;                                                                                                                                                                </div>
<div>  double y = 60;                                                                                                                                                                 </div>
<div>  trans->Transform(1, &x, &y);                                                                                                                                                   </div>
<div>                                                                                                                                                                                 </div>
<div>  std::cout << "x=" << x << " y=" << y << "\n";                                                                                                                                  </div>
<div>} </div>
<div><br>
​<br>
</div>
<p><br>
</p>
</body>
</html>