[gdal-dev] Error while using osr.CoordinateTransformation (point outside of domain) with orthographic projection

afernandez afernandez at odyhpc.com
Mon Jan 20 13:45:05 PST 2025


Hello,
While transforming point coordinates from lat/lon to a specified 
projection, I keep running into errors while trying to use some 
projections. The line generating the error reads:
transform = osr.CoordinateTransformation(srs_in, srs_out)
For example, when defining "+proj=webmerc +datum=WGS84" srs_out reads:
PROJCS["unknown",
GEOGCS["unknown",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]]],
PROJECTION["Mercator_1SP"],
PARAMETER["central_meridian",0],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AXIS["Easting",EAST],
AXIS["Northing",NORTH],
EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 
+x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs"]].
The completes the transformation and yields good results. However, defining 
the projection as "+proj=ortho +lon_0=-75.0 +ellps=WGS84 +datum=WGS84" 
yields srs_out equal to
PROJCS["unknown",
GEOGCS["unknown",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]]],
PROJECTION["Orthographic"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",-75],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AXIS["Easting",EAST],
AXIS["Northing",NORTH]]
but the code generates the following error:
File "/usr/lib/python3/dist-packages/osgeo/ogr.py", line 7400, in Transform
return _ogr.Geometry_Transform(self, *args)
RuntimeError: Point outside of projection domain
I've tried many other definitions of the projection (e.g. "+proj=ortho 
+lon_0=-75.0 +R=6371229.0") but with the same error. I really don't know if 
I'm doing something wrong or if this is a bug and I should create a Github 
ticket. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250120/5fe0b82c/attachment.htm>


More information about the gdal-dev mailing list