Geographical coordinates using GDAL reading pixel values of the image

A recent project known soundings need to download the electronic chart, the export geographic coordinates (latitude and longitude) points. Then opened in these geographical coordinates arcgis output shp, read point corresponding to different bands of pixel values ​​using GDAL, and to construct corresponding relationship between pixel depth values.

In fact, there are two ways you want to get cell values ​​based on latitude and longitude.

1. By selecting point arcpy output pixel value, this method is simple and quick, depending on arcgis.

2. Read the latitude and longitude (degrees minutes and seconds) by GDAL, converted into decimal form. Using the GDAL CoordinateTransformation method is converted into latitude and longitude coordinates of the projection, converted to row and column coordinates, the final pixel value is read. Here is the official document inside the code for reference.

 

Which GetGeoTransform get geospatial image acquisition range, resolution information. 1, 4 value is the upper left corner of the first coordinate cell center. 2,6 spatial resolution xy direction. 3,5 rotation and translation factor coefficient.

The SpatialReference () to establish a spatial reference, projection information getProjection return to wkt output format, and reading methods and create strings ImportFromWkt geographic coordinate system, the reference surface, projection method, resolution and the like.

CloneGeoCS way to create geographic coordinates (latitude and longitude), CoordinateTransformation conversion method for establishing relations projected coordinate system and the geographic coordinate system, TranformPoint method to convert geographic coordinates into the relationship, get projection coordinates, and finally calculate the number of ranks.

Tips

1.list out of range should be entered in a list format issue.

2. Also note that the input longitude and latitude position.

 

Guess you like

Origin www.cnblogs.com/ljwgis/p/11861072.html