dshean / demcoreg

Utilities for DEM and point cloud co-registration
MIT License
110 stars 42 forks source link

Input images do not intersect #23

Closed Keeptg closed 4 years ago

Keeptg commented 4 years ago

Hello! I try to use dem_align.py co-register a SRTM DEM and a COPDEM (more details about COPDEM) by typing python dem_align.py dem1_path dem2_path. I've conformed that the two DEM is intersected (the SRTM DEM is larger than COPDEM, so COPDEM is 100% intersected with SRTM DEM).

At the beginning, there are six consecutive errors:

proj_create: Error -38: failed to load datum shift file                                                  
proj_create: Error -38: failed to load datum shift file                                                  
proj_create: Error -38: failed to load datum shift file                                                  
proj_create: Error -38: failed to load datum shift file                                                  
proj_create: Error -38: failed to load datum shift file                                                  
proj_create: Error -38: failed to load datum shift file

But the script finished the first iteration and saved a "Nuth and Kaab plot" in the disk.

While at the beginning of the second iteration, a Input images do not intersect appeared and the script is over.

Did I miss any thing?


I insalled imview, pygeotools, and demcoreg by using git and pip

My demcoreg lib version is 0.5.0, and pygeotools lib version is 0.6.0, and imview lib version is 0.3.0

My python version is 3.7.6

My operating system is Ubuntu 20.04

Keeptg commented 4 years ago

I read the code again. The reason caused above error should be this:

Regardless of whether the DEM is projected or not, the xy-offset calculated by Nuth's method is always in meter. When the script execute xy shift sentence, it didn't check for projection. So, if the DEM is in geographic coordinate system, the coreglib.apply_xy_shift() function will lead a totally wrong result, because it minus a meter offset value from a degree coordinate. Unfortunately, besides projecting the DEM before executing dem_align.py, I haven't thought of any other way to fix this problem. Do you have any suggestion about this?

dshean commented 4 years ago

Thanks for the report @Keeptg, and for following up. I agree with your assessment. I would not recommend using geographic coords here, as you're mixing units (degrees and meters) and you will have scaling issues (variable length of a degree of longitude as a function of latitude, so the translation vector will be nonuniform across larger source DEM). If you reproject your source DEM to an appropriate local coordinate system, then dem_align should warp the reference DEM to match. Hope that helps!