Monday, 4 April 2016

python - Flipped (Y-axis) Raster from point cloud


I have been working on a project where I need to create rasters from irregularly spaced point clouds. I am resampling my point clouds to a regular 0.25 cm grid using a nearest neighbor method pyresample. I am using the output array to make a raster using GDAL and my raster is inverted on the y-axis. For a particular dataset I get the extents and apply a geotransfrom using the following parameters:


top_left_x(i.e., xMin)
top_left_y(i.e., yMax)
x_resolution
y_resolution
x_rotation

y_rotation

For a hypothetical dataset, let's say my geo transform parameters are:


top_left_x(i.e., xMin)=223280.0
top_left_y(i.e., yMax)=577877.75
x_resolution=0.25
y_resolution=-0.25
x_rotation=0
y_rotation=0


Using GDAL's GTiff driver I am successfully creating rasters by writing the output array Result to rasterband(1). The problem is the output raster us upside down w.r.t the y axis. If I flip the array result using numpy like: np.flipud(result), the raster is plotted in the correct position. I am at a loss why I need to flip result and want to see if someone can help me understand why.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...