easyidp.geotiff.pixel2geo¶
- easyidp.geotiff.pixel2geo(points_hv, header)¶
[Deprecated] Convert geotiff pixel coordinate (horizontal, vertical) to geo coordinate (x, y)
..caution::W
Since v2.0.2, this function is deprecated, the conversion method is old and may not accurate. Please use :func:`easyidp.geotiff.GeoTiff.pixel2geo <easyidp.geotiff.GeoTiff.pixel2geo> instead, a warpper for rasterio.io.DatasetReader.xy() function
- 参数:
points_hv (numpy nx2 array) -- [horizontal, vertical] points
header (dict) -- the geotiff head dictionary from get_header()
- 返回类型:
The ndarray pixel position of these points (horizontal, vertical)
示例
>>> header = {'width': 19436, 'height': 31255, 'dim':4, 'scale': [0.001, 0.001], 'nodata': None, 'tie_point': [484576.70205, 3862285.5109300003], 'crs': pyproj.CRS.from_string("WGS 84 / UTM zone 53N")} >>> pixel_coord = np.asarray([ [16972, 26086], [16708, 25585], [16946, 25445], [17228, 25956], [16972, 26086]]) >>> idp.geotiff.pixel2geo(pix_coord, header) array([[16972.69654 , 26086.79569047], [16708.59742997, 25585.10598028], [16946.36805996, 25445.77883044], [17228.72418998, 25956.37087012], [16972.69654 , 26086.79569047]])