Georeferencing tiff by creating tfw file

Delfos, Jacob jacob.delfos at MAUNSELL.COM
Wed Nov 16 18:26:43 EST 2005


Dejan,

I'm not the expert on images here, but this is what I understand:

A world file (tfw, jgw, sdw, etc) has 6 parameters:

Cellsize X
skew X (normally 0)
skew Y (normally 0)
Cellsize Y (usually negative, as it counts from top (high) to bottom
(low) )
Top-left X
Top-left Y

A good website I just noticed as well is:
http://duff.ess.washington.edu/data/raster/drg/tfw.html

When your colleagues says he "built the tfw on a CAD overlay", it
probably means he used CAD data to georeference the image, and then got
the TFW based on the transformation. So be wary that your image position
will not be more precise than the CAD it was based on. 
Your calculations may be correct, but I doubt very much that things will
end up at the right scale if something was made at a certain scale,
printed, and scanned again. Too many factors that can introduce
distortion. So don't rely on that unless you have to.

Hope this helps,

Jacob




> -----Original Message-----
> From: UMN MapServer Users List 
> [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of Dejan Gambin
> Sent: 17 November 2005 07:07
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-USERS] Georeferencing tiff by 
> creating tfw file
> 
> Sorry I forgot to set the CC..
> 
> I have received this tif file from a colleague who wanted to 
> "georeference"
> it and place it on the existing mapserver map. He just sent 
> me the upper
> left coordinates (real world coordinates in meters) and this 
> scale. Suppose
> he scanned the paper map that is in 1:25 scale and gave me 
> the coordinates
> of the upper left corner. So I thought:
> 
> ..if the map is in 1:25 scale, that means that 1 inch on the map is 25
> inches in the real world....if the map was scanned on 300dpi 
> then the pixel
> size is 25/300 in inches, then converted to meters. But it is not and
> obviously I am pretty newbie in this geo-math and I am missing some
> important things. 
> 
> Anyway, after a while he sent me a tfw file saying he has 
> built it with CAD
> Overlay...that is all I know and this tiff is now positioned 
> well on the
> map...
> 
> ...Sorry, I am just curious in how this is 
> theoretically/mathematically
> calculated so I asked....
> 
> This is also interesting to me because we have some 
> non-referenced tiff maps
> with some known world coordinates on them and I would like to 
> georeference
> them in the future, if this is possible...
> 
> regards, dejan
> 
> > -----Original Message-----
> > From: Ed McNierney [mailto:ed at topozone.com] 
> > Sent: Wednesday, November 16, 2005 10:54 PM
> > To: Dejan Gambin; MAPSERVER-USERS at LISTS.UMN.EDU
> > Subject: RE: [UMN_MAPSERVER-USERS] Georeferencing tiff by 
> > creating tfw file
> > 
> > 
> > Dejan -
> > 
> > Well, that's not the GeoTIFF output you posted the first time <g>!
> > 
> > What is the "scale" you have (the value that's 25.40363554)?  
> > What is the definition of that value, and its units (if any)? 
> >  And what are the definition and the units of the "CAD 
> > Overlay" output, too?  It's hard to work with dimensionless, 
> > undefined numbers - where did they come from? We need some 
> > more details to be able to help.  Thanks!
> > 
> > 	- Ed
> > 
> > P.S.  Please always reply to the whole list, not just to the 
> > first responder.
> > 
> > Ed McNierney
> > President and Chief Mapmaker
> > TopoZone.com / Maps a la carte, Inc.
> > 73 Princeton Street, Suite 305
> > North Chelmsford, MA  01863
> > ed at topozone.com
> > (978) 251-4242   
> > 
> > -----Original Message-----
> > From: Dejan Gambin [mailto:dejan.gambin at pula.hr] 
> > Sent: Wednesday, November 16, 2005 4:31 PM
> > To: Ed McNierney
> > Subject: RE: [UMN_MAPSERVER-USERS] Georeferencing tiff by 
> > creating tfw file
> > 
> > Ed,
> > 
> > Sorry, I have run gdalinfo on the tiff with already existing 
> > tfw file that I have calculated and that is WRONG...
> > 
> > Running gdalinfo on this tif (that has no associated tfw) 
> results in:
> > 
> > Driver: GTiff/GeoTIFF
> > Size is 8857, 5905
> > Coordinate System is `'
> > Metadata:
> >   TIFFTAG_XRESOLUTION=300
> >   TIFFTAG_YRESOLUTION=300
> >   TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch) Corner Coordinates:
> > Upper Left  (    0.0,    0.0)
> > Lower Left  (    0.0, 5905.0)
> > Upper Right ( 8857.0,    0.0)
> > Lower Right ( 8857.0, 5905.0)
> > Center      ( 4428.5, 2952.5)
> > Band 1 Block=8857x5905 Type=Byte, ColorInterp=Palette
> >   Color Table (RGB with 2 entries)
> >     0: 255,255,255,255
> >     1: 0,0,0,255
> > 
> > So, I have this output, I have xy coordinates (in meters): 
> > 5455750 and 5021000 and I have the scale of 25.40363554. The 
> > question remains - how do I calculate the "pixel size" (first 
> > and fourth parameter) of tfw file that I need to create. 
> > 
> > Using CAD Overlay I get the value of 0.08467878514170 that is 
> > correct but I need to know how to get this value by formula, 
> > not with util like CAD Overlay
> > 
> > Sorra again
> > 
> > regards, dejan
> > 
> > > -----Original Message-----
> > > From: UMN MapServer Users List 
> > [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] 
> > > On Behalf Of Ed McNierney
> > > Sent: Wednesday, November 16, 2005 4:51 PM
> > > To: MAPSERVER-USERS at LISTS.UMN.EDU
> > > Subject: Re: [UMN_MAPSERVER-USERS] Georeferencing tiff by 
> > creating tfw
> > 
> > > file
> > > 
> > > 
> > > Dejan -
> > > 
> > > The gdalinfo utility is telling you the pixel size.  The 
> fourth line
> > > of the output below, beginning with "Origin = ", ends with 
> > "Pixel Size
> > 
> > > = ". Those are the very same values you would use in the first and
> > > fourth lines, respectively, of a TFW file.  It looks like 
> > this is the 
> > > same value you calculated, and it appears to be correct.
> > > 
> > > 	- Ed
> > > 
> > > Ed McNierney
> > > President and Chief Mapmaker
> > > TopoZone.com / Maps a la carte, Inc.
> > > 73 Princeton Street, Suite 305
> > > North Chelmsford, MA  01863
> > > ed at topozone.com
> > > (978) 251-4242
> > > 
> > > -----Original Message-----
> > > From: UMN MapServer Users List 
> > [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] 
> > > On Behalf Of Gambin Dejan
> > > Sent: Wednesday, November 16, 2005 8:59 AM
> > > To: MAPSERVER-USERS at LISTS.UMN.EDU
> > > Subject: [UMN_MAPSERVER-USERS] Georeferencing tiff by creating tfw
> > > file
> > > 
> > > Hi,
> > > 
> > > Even there are probably some utils I can use, I would 
> still like to
> > > know how can I calculate the "pixel size" parameter in 
> tfw file (so 
> > > the first and fourth parameter) from the existing tiff 
> file and the 
> > > following
> > > informations:
> > > 
> > > For example, "gdalinfo my.tif" says
> > > 
> > > Driver: GTiff/GeoTIFF
> > > Size is 8857, 5905
> > > Coordinate System is `'
> > > Origin = (5455749.998925,5021000.001075) Pixel Size =
> > > (0.00215084,-0.00215084)
> > > Metadata:
> > >   TIFFTAG_XRESOLUTION=300
> > >   TIFFTAG_YRESOLUTION=300
> > >   TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch) Corner Coordinates:
> > > Upper Left  ( 5455749.999, 5021000.001) Lower Left  ( 
> 5455749.999, 
> > > 5020987.300) Upper Right ( 5455769.049,
> > > 5021000.001) Lower Right ( 5455769.049, 5020987.300)
> > > Center      ( 5455759.524, 5020993.651)
> > > Band 1 Block=8857x5905 Type=Byte, ColorInterp=Palette
> > >   Color Table (RGB with 2 entries)
> > >     0: 255,255,255,255
> > >     1: 0,0,0,255
> > > 
> > > I have xy coordinates (in meters): 5455750 and 5021000 
> and the scale
> > > of 25.40363554. I have tried using the simple formula like:
> > > 
> > > pixel size in inches = scale/resolution, so 25.40363554/300 and
> > > converting it to meters gives me 0.002150841. But this is 
> > not correct,
> > 
> > > right?
> > > 
> > > Wiht CAD overlay I have got 0.08467878514170, that is probably
> > > right...
> > > 
> > > What am I doing wrong? Is it the resolution that I am using?
> > > Do I have to use screen resolution or what?
> > > 
> > > thanks
> > > 
> > > regards, dejan
> > > 
> > 
> > 
> 



More information about the mapserver-users mailing list