Data Tranformation/Convertion
From IOSN-InWent FOSS GIS & Sahana Training
Contents |
Overview
Now we'll use GDAL library to convert the basemap (raster & vector) to UTM compatible format (also still raster & vector but now UTM compatible because GDAL library adds some meta/header and modified it).
UTM
The Universal Transverse Mercator (UTM) coordinate system is a grid-based method of specifying locations on the surface of the Earth. It is used to identify locations on the earth, but differs from the traditional method of latitude and longitude in several respects. There were some formulas to convert coordinate system to UTM, in Linux the GDAL library helped us with this convertion.
WGS84
The World Geodetic System defines a reference frame for the earth, for use in geodesy and navigation. The latest revision is WGS 84 dating from 1984 (last revised in 2004), which will be valid up to about 2010.
GDAL
GDAL is a library for reading and writing raster geospatial data formats, and is released under an X/MIT style Open Source license by the Open Source Geospatial Foundation. As a library, it presents a single abstract data model to the calling application for all supported formats. It may also be built with a variety of useful command-line utilities for data translation and processing. GDAL/OGR is considered a major project in the Open Source and also in the commercial GIS community due to its widespread use and comprehensive set of functionalities.
Raster Convertion
This is some converting command line:
$> gdalwarp -t_srs "+datum=wgs84 +proj=utm +zone=47 +south" -s_srs "+datum=wgs84 +proj=latlong" /home/fossgis/maps/raster/srtm/SRTM_MENTAWAI.tif /home/fossgis/maps/raster/srtm/SRTM_MENTAWAI_UTM.tif
Is our converting process success? We can check it with:
$> gdalinfo /home/fossgis/maps/raster/srtm/SRTM_MENTAWAI_UTM.tif
If we know the EPSG code of our location, we can also use this code. As an example, if our region is located like the above WKT Code, the EPSG code is 32647 (for UTM projection) and 4326 (for geodetic projection). So, we can write the raster conversion using gdalwarp with a shorter text to input, like this :
$> gdalwarp -t_srs "EPSG:32748" -s_srs "EPSG:4326" /home/fossgis/maps/raster/srtm/SRTM_MENTAWAI.tif /home/fossgis/maps/raster/srtm/SRTM_MENTAWAI_UTM.tif
Vector Convertion
$> ogr2ogr -f "ESRI Shapefile" -t_srs "+datum=wgs84 +proj=utm +zone=47 +south" -s_srs "+datum=wgs84 +proj=latlong" NEW_DIRECTORY OLD_DIRECTORY
Don't forget about the directory convention:
/NEW_DIRECTORY
NEW_DIRECTORY.shp
NEW_DIRECTORY.dbf
NEW_DIRECTORY.shx
NEW_DIRECTORY is different layers (road, river etc.) To make the naming convention easier we can set the OLD_DIRECTORY to NEW_DIRECTORY_UTM.
And the result directory:
/NEW_DIRECTORY_UTM
NEW_DIRECTORY.shp
NEW_DIRECTORY.dbf
NEW_DIRECTORY.shx
Is our converting process success? We can check it with:
$> ogrinfo /home/fossgis/maps/vektor/jalan_mentawai_utm
On to Step 4: Linux Environment Setup for GRASS

