Thursday 29 October 2015

gdal - Comparing projections of two datasets when SRID not available


Similar to this question: How to test if two GDAL datasets are in the same projection?


However, the above does not cover cases where an SRID is not available. It can often be the case that an SRID is not specified and the WKT between 2 datasets of the same projection does not precisely match.



What is your strategy for determining whether 2 datasets are of the same projection (using python) in this case?


It is annoying to go through the whole process of reprojecting a dataset just because the WKT strings do not exactly match, even though they are in the same projection.


osr's Spatial Reference class can allow us toe get the projection information in a number of formats, and I often find that comparing the results of ExportToProj4() rather than ExportToWkt() to be more reliable in matching projections. However, I do not know if it is 'bullet-proof'?


Another method could be to parse the WKT strings and match the 'important' parts. This has 2 questions: 1. Does anyone know an efficient method (in python) of breaking a WKT string into it's constituent parts which can be easily compared? 2. What are the relevant parts of a WKT string, or how can you determine this?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...