[GRASS-user] OT: transform mapinfo tab file with coordsys to world file

Hamish hamish_nospam at yahoo.com
Fri Oct 26 22:45:47 EDT 2007


Moritz Lennert wrote:
> We have a series of georeferenced .tif files accompanied by .tab files 
> which look like this:
> 
> Definition Table
>    File "s5_15 nw3_b-iii.tif"
>    Type "RASTER"
>    (513881,9523020) (1008,1098) Label "Pt 1",
>    (519881,9523020) (10493,1111) Label "Pt 2",
>    (519881,9517020) (10451,10523) Label "Pt 3",
>    (513881,9517020) (990,10509) Label "Pt 4"
>    CoordSys Earth Projection 8, 104, "m", 15, 0, 0.9996, 500000, 10000000
>    Units "m"
>
> However, gdal does not support the Mapinfo's CoordSys:
> "only control points used, Coordsys ignored" 
> (http://www.gdal.org/frmt_gtiff.html).
> 
> I guess that if we could transform these files into ESRI world files 
> (http://www.gdal.org/frmt_various.html#WLD), we could import them easily 
> with GDAL. But how to do this, as ESRI world files give transformation 
> parameters, not points and projection info ?
> 
> Or is this the wrong approach ?
> 
> We can obviously easily import each file into an XY location and then 
> run i.rectify on the basis of the available points, but I was wondering 
> whether there is a better way.


1) check if the georeferecing info is registered in the tiff file (if it is a
GeoTIFF) with 'gdalinfo'. If it is, just use r.in.gdal.

2) If gdalinfo shows no georeferecing info in the file, you can add those four
ground control points with 'gdal_translate' -gcp'. Note the "line" parameter (y
pixel) may start from the top, not the bottom, so you might need to do
height-line_number. (only try that if it fails)

A quick search of the EPSG file shows 6 possibles:

$ grep -B1 500000 /usr/share/proj/epsg | grep -B1 10000000 | grep -B1 0.9996

# Batavia / TM 109 SE
<2308> +proj=tmerc +lat_0=0 +lon_0=109 +k=0.999600 +x_0=500000 +y_0=10000000
+ellps=bessel +units=m +no_defs  <>
# WGS 84 / TM 116 SE
<2309> +proj=tmerc +lat_0=0 +lon_0=116 +k=0.999600 +x_0=500000 +y_0=10000000
+ellps=WGS84 +datum=WGS84 +units=m +no_defs  <>
# WGS 84 / TM 132 SE
<2310> +proj=tmerc +lat_0=0 +lon_0=132 +k=0.999600 +x_0=500000 +y_0=10000000
+ellps=WGS84 +datum=WGS84 +units=m +no_defs  <>
--
# Camacupa / TM 11.30 SE
<22091> +proj=tmerc +lat_0=0 +lon_0=11.5 +k=0.999600 +x_0=500000 +y_0=10000000
+ellps=clrk80 +units=m +no_defs  <>
# Camacupa / TM 12 SE
<22092> +proj=tmerc +lat_0=0 +lon_0=12 +k=0.999600 +x_0=500000 +y_0=10000000
+ellps=clrk80 +units=m +no_defs  <>
--
# WGS 84 / TM 36 SE
<32766> +proj=tmerc +lat_0=0 +lon_0=36 +k=0.999600 +x_0=500000 +y_0=10000000
+ellps=WGS84 +datum=WGS84 +units=m +no_defs  <>


any of those look familiar?


3) Do you know what projection it is supposed to be in? If you can find the
EPSG code for that you can add that into the GeoTIFF with 'gdal_translate
-a_srs' or create a new GRASS location using those parameters. Then import with
 'r.in.gdal -o'


Seeing you do have some numbers there already, importing to a XY location and
using i.rectify should be a last resort. (note, you can use those four given
tie points in the i.rectify POINTS file, it's plain text edit it by hand after
setting a few rough points to see the format/order)


Hamish


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the grass-user mailing list