jorgealmerio / valuetool

QGis plugin to display in a table or plot the values from the visible raster layers at the current mouse position
4 stars 7 forks source link

Added height from DTM to coordinate string #5

Closed mwindowshz closed 4 years ago

mwindowshz commented 4 years ago

HI I was searching for a tool to see elevation data from DEM / DTM file.

Found your ValueTool had a problem that the prining of the value was according to the loaded raster, and if my DTM is composed of several files, I cannot hover mouse and see the hight, it every time prints in diffrent line in the table and some are hidden.

wrote a solution, I am not sure the code is nice, but it works well. now I can load DTM,, or orthphoto and DTM, and hover with mouse over them and get coordinate and height.

image

I added these lines: image

I am going to try to do a pull request as well.

Thanks for your great tool. This is such a basic function missing from QGIS, to display full coordinate and height.

M.

ident = layer.dataProvider().identify(pos, QgsRaster.IdentifyFormatValue, canvas.extent(), width, height ).results()

                  #   test add DEM value to have coordinate and height
                  if ident is not None:
                    if len(ident) == 1:
                        try:
                            self.labelStatus.setText(self.tr('Coordinate:') + ' (%f, %f,%f)' % (position.x(), position.y(),ident.get(1)))
                        except:
                            t = 100
jorgealmerio commented 4 years ago

Hi, I did your suggestion! But I could not made it to work using your Pull request. I Inserted 1 code line at 379:

# mwindowshz Pull Request self.labelStatus.setText(self.tr('Coordinate:') + '{},{},{}'.format(position.x(), position.y(),bandvalue))

I hope you don't mind!