Saturday, 16 September 2017

gdal - What are the appropriate parameters to convert .asc file to geotiff using gdal_translate?


My starting file of interest is an ASC file with the following gdalinfo



Driver: AAIGrid/Arc/Info ASCII Grid 
Files: sd_1_3_110805.asc
Size is 11880, 9720
Coordinate System is `'
Origin = (-117.900000000000010,33.399999999999991)
Pixel Size = (0.000092592592593,-0.000092592592593)
Corner Coordinates:
Upper Left (-117.9000000, 33.4000000)
Lower Left (-117.9000000, 32.5000000)
Upper Right (-116.8000000, 33.4000000)

Lower Right (-116.8000000, 32.5000000)
Center (-117.3500000, 32.9500000)
Band 1 Block=11880x1 Type=Float32, ColorInterp=Undefined
NoData Value=-9999

To translate to a tiff I have tried:


gdal_translate sd_1_3_110805.asc lj.tif

Subsequently I would like to change the projection to UTM flat to ultimately create a 3d model of flat vs geocentric terrain.


Unless I have specified using a geocentric model to osgdem (VirtualPlanetBuilder) to build the 3d terrain model, my model always comes out mirror image (north is south etc...). So I desire to use a flat terrain model... what parameters should I be using to get to a geotiff with the correct projection to start with?




Answer



gdal_translate can project your output to UTM as part of the conversion. Try this:


gdal_translate -a_srs  sd_1_2_110805.asc lj.tif

Replace with any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file containing the WKT (see gdal_translate help page). I prefer using EPSG codes since I often get the GDAL/OGR forms wrong. For example, if you need to reproject to WGS 84 / UTM zone 17N use EPSG:32617:


gdal_translate -a_srs EPSG:32617 sd_1_2_110805.asc lj.tif

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...