Georeferencing tiff by creating tfw file

Ed McNierney ed at TOPOZONE.COM
Wed Nov 16 18:42:57 EST 2005


Dejan -

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

Yes, that's all there is to it.  There's nothing more to understand.  If
the scale you're reporting in CAD Overlay is in units of "meters per
pixel", then one pixel is 0.08467878514170 meters.  If that image were
scanned at 600 DPI, then each inch on the printed map source would
produce 600 pixels or 50.80 meters.  50.80 meters is 2,000 feet, so that
would correspond to a scale of 1" = 2,000' or 1:24,000 scale.  Or it
could be a 1:12,000 scale map scanned at 300 DPI - or a 1:48,000 scale
map scanned at 1,200 DPI.  They would all come out the same - the image
resolution in units per pixel is a product of the source scale and the
scanning resolution, and you can't distinguish the two.

	- Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
Phone: +1 (978) 251-4242
Fax: +1 (978) 251-1396
ed at topozone.com

-----Original Message-----
From: Dejan Gambin [mailto:dejan.gambin at pula.hr] 
Sent: Wednesday, November 16, 2005 6:07 PM
To: Ed McNierney
Cc: 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