In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "python how to use longitude and latitude point coordinates to read elevation information in DEM", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "python how to use longitude and latitude point coordinates to read elevation information in DEM" this article.
Realization conditions: 1. The library you need to use is GDAL;2.DEM data.
1. Train of thought
(1) use GDAL to read DEM data. First, get the first band and read it as an array. The function is:
Ds.GetRasterBand (1) and band.ReadAsArray ()
(2) calculate the row number according to longitude and latitude
(3) the elevation information can be read directly according to the row number.
two。 Code
The code and comments are as follows:
From osgeo import gdalgdal.UseExceptions () # take Hubei DEM data as an example ds = gdal.Open ('. / data/hubei_wgs84.tif') band = ds.GetRasterBand (1) elevation = band.ReadAsArray () nrows, ncols = elevation.shapex0, dx, dxdy, y0, dydx, dy = ds.GetGeoTransform () # specify latitude and longitude point coordinates latitude,longitude=31.15111.24# calculates row numbers based on longitude and latitude, dx=dy is the resolution When (y0-latitude) / dx is changed to (y0-latitude) /-dynew_ncols,new_nrows=int ((y0-latitude) / dx), int ((longitude-x0) / dx) # reads and prints the specified coordinate point elevation print (elevation [new _ ncols] [new_nrows]) 3 according to the row number. Result
932, that is, the elevation is 932m
4.Arcgis verification
Use the Go To XY tool, the rightmost tool in the toolbar
Enter the latitude and longitude coordinates to locate to this point:
Add the point to the map
Use Identity to view the point properties:
The results are consistent.
The above is all the contents of the article "how to read the elevation information in DEM with the coordinates of longitude and latitude points in python". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.