I have a DEM file of building heights calculated from DSM-DTM in QGIS. Based on this DEM file, I generated a mask that indicates the presence of buildings in matlab. However, when I load the building mask back in QGIS, I found that the two files do not appear on the same extent.

Upon checking their properties, I found that while their CRS are the same, their Layer Extent (layer original source projection) are different.

Both of their Layer Spatial Reference System are as follows: +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=375,-111,431,0,0,0,0 +units=m +no_defs

For DEM file, the layer extent is

570000.0000000000000000,180000.0000000000000000 : 585000.0000000000000000,190000.0000000000000000

For the building mask generated in matlab, the layer extent is

Layer Extent (layer original source projection)

0.0000000000000000,-2033.0000000000000000 :

I think the problem is that when I carried out image processing in matlab, it just reads the matrix values without retaining its spatial information, thus changing the later extent from 570000 back to 0, as can be seen above.

I have tried to approach it from both QGIS and Matlab, however, with no success so far. I am wondering if anyone has solutions to this or experience with ensuring that the spatial extent remains the same.

Both the files and matlab script can be accessed in this link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.