[Qgis-user] No transform available between XXX and EPSG:4326 when using non-Earth projections

Even Rouault even.rouault at spatialys.com
Thu Mar 18 15:36:23 PDT 2021


Le 18/03/2021 à 23:25, Nyall Dawson a écrit :
> On Fri, 19 Mar 2021 at 07:04, Even Rouault <even.rouault at spatialys.com> wrote:
>> Sebastian,
>>
>> I can reproduce the 2 error messages you got. There's indeed something in QGIS that tries a terrestrial reprojection and should be fixed, but I don't think this is really critical apart of the annoyance of being spammed about that. Please file a QGIS issue to track this.
> There's two parts in particular which cause this warning to be shown,
> and indeed make an assumption that lat/lng === EPSG:4326
> - The status bar coordinate widget
> - The CRS selector "area of use" preview widget
>
> We probably need api for testing "is non earth crs" and "given a
> non-earth crs, give me a lat/long crs for the same planetary body" to
> resolve these. But as Even has pointed out neither are critical
> functionality, and the warning can be ignored.

At the PROJ API level, you can extract the underlying geodetic CRS 
(which in 99% of the cases will be a geographic one) of a CRS (be it a 
geographic, projected or compound one) with proj_crs_get_geodetic_crs(). 
proj_normalize_for_visualization() might be needed to get a consistent 
lon, lat axis order.

The "advantage" of this is that if you just want to see the lat, long of 
any projected CRS without requiring the datum to be WGS 84, it will work 
and without the complications of datum adjustments. And you don't need 
to distinguish Earth vs non-Earth use cases.

Pedantic note: if the CRS is a Geocentric CRS, then 
proj_crs_get_geodetic_crs() will return it, and not a geographic CRS as 
one might perhaps expect. A geodetic CRS may be a geocentric (X,Y,Z) or 
a geographic (lat,lon lon,lat) one). To get a geographic CRS from that, 
you'd need to extract its datum ( proj_crs_get_datum() and then build a 
geographic CRS with proj_create_geographic_crs_from_datum() ), but 
that's quite unlikely to be needed in QGIS use cases.


> Nyall
>
>
>> That said, I managed to do a non-Earth reprojection by adding a custom CRS with the following WKT definition:
>>
>> GEOGCRS["MARS Geographic",
>>
>> DATUM["D_MARS",
>>
>> ELLIPSOID["MARS",3396000,0,
>>
>> LENGTHUNIT["metre",1,
>>
>> ID["EPSG",9001]]]],
>>
>> PRIMEM["Reference meridian",0,
>>
>> ANGLEUNIT["degree",0.0174532925199433,
>>
>> ID["EPSG",9122]]],
>>
>> CS[ellipsoidal,2],
>>
>> AXIS["longitude",east,
>>
>> ORDER[1],
>>
>> ANGLEUNIT["degree",0.0174532925199433,
>>
>> ID["EPSG",9122]]],
>>
>> AXIS["latitude",north,
>>
>> ORDER[2],
>>
>> ANGLEUNIT["degree",0.0174532925199433,
>>
>> ID["EPSG",9122]]]]
>>
>> and selecting it as the project CRS. Using ESRI:104905 (GCS_Mars_2000) seems to also work (I haven't deeply checked but I do get a reprojected raster and geographic coordinates), but you'll get each time the warnings about the 2 terrestrial coordinate operations. Hopefully in coming months, I'll be able to ingest the IAU catalog into the PROJ database as well.
>>
>> Even
>>
>> Le 18/03/2021 à 21:07, Sebastian Walter a écrit :
>>
>> Hi,
>>
>> Since Version 3.X I'm not able to perform transformations on planetary (non-Earth) data (from e.g. Mars or Mercury, example dataset: https://maps.planet.fu-berlin.de/mex4/h1104_0000.ihs.53.tif). The error message is:
>>
>> No transform is available between SINUSOIDAL MARS and Custom CRS: GEOGCRS["unknown",DATUM["unknown",ELLIPSOID["WGS 8….
>> proj_create_operations: Source and target ellipsoid do not belong to the same celestial body
>> No transform available between SINUSOIDAL MARS and EPSG:4326
>>
>> The consequence is that transformations to lat/lon are not possible any more. With the older QGis there was no problem like this. My suspect is the "new" Proj6 database layout, but the above error messages also point to the fact there there is some EPSG:4326 projection hard-coded into Qgis.
>>
>> Is anybody successfully using Qgis with non-Earth data and proper transformations?
>>
>> Thanks for any advise...
>>
>> Sebastian
>>
>>
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>> --
>> http://www.spatialys.com
>> My software is free, but my time generally not.
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the Qgis-user mailing list