Thank you Nyallfor clarifying. After sending my answer I realized that there can be projection which are not registered and have an official code
Best Stefan Am 14.10.2021 um 02:49 schrieb Nyall Dawson:
On Wed, 13 Oct 2021 at 20:10, Stefan Giese (WhereGroup) <[email protected]> wrote:in python I would do it like this one: l = iface.activeLayer() if l.crs().authid() != "": print(l.crs().authid ()) else: print("No projection")This isn't quite right -- e.g. a geographic CRS like WGS 84 will still have an authid ("EPSG:4326"). As Etienne pointed out .isGeographic() is the correct way to test that. I think here you might be trying to check instead if the layer has a valid CRS set (as opposed to "no CRS set"), which should be tested instead by: if not l.crs().isValid(): print("No CRS set") (Also noting that a perfectly valid CRS may not have an authid if it came from a custom wkt definition and isn't matched to any official registry entry)... phew! NyallAm 13.10.2021 um 11:50 schrieb pierluigi de rosa: Dear all, mayble a very simple question. Is it possible to check quickly if a layer has a projected CRS or not? in QgsCoordinateReferenceSystem I have not found a method able to do that check. Thanks for your attention Pierluigi -- Ing. Pierluigi De Rosa (PhD in Earth Science) Contract Professor of Geographic Information System at University of Perugia cel: 3497558268 / fax: 075 7823038 skype: pierluigi.derosa _______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer -- Mit freundlichen Grüßen Stefan Giese Projektleiter/Consultant --------------------------------------------- Schon gewusst? In unserem Blog geben wir Tipps & Tricks zu Open-Source-GIS-Software und berichten aus unserem Experten-Alltag: https://wheregroup.com/blog/ --------------------------------------------- WhereGroup GmbH Schwimmbadstr. 2 79100 Freiburg Germany Fon: +49 (0)761 / 519 102 - 61 Fax: +49 (0)761 / 519 102 - 11 [email protected] www.wheregroup.com Geschäftsführer: Olaf Knopp, Peter Stamm Amtsgericht Bonn, HRB 9885 _______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-- Mit freundlichen Grüßen Stefan Giese Projektleiter/Consultant ------------------------------------------------------ Aufwind durch Wissen! Jetzt neu: Webinare und Online-Schulungen bei der www.foss-academy.com ------------------------------------------------------ WhereGroup GmbH Schwimmbadstr. 2 79100 Freiburg Germany Fon: +49 (0)761 / 519 102 - 61 Fax: +49 (0)761 / 519 102 - 11 [email protected] www.wheregroup.com Geschäftsführer: Olaf Knopp, Peter Stamm Amtsgericht Bonn, HRB 9885
OpenPGP_signature
Description: OpenPGP digital signature
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
