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

Even Rouault even.rouault at spatialys.com
Mon Jan 20 14:30:12 PST 2025


Hi,

The image at 
https://proj.org/en/stable/operations/projections/ortho.html and note 
"Defined area: Global, although only one hemisphere can be seen at a 
time" should answer your question

Even

Le 20/01/2025 à 22:45, afernandez via gdal-dev a écrit :
> 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.
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
Butcher of all kinds of standards, open or closed formats. At the end, this is just about bytes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250120/cd90010a/attachment-0001.htm>


More information about the gdal-dev mailing list