# TIFFwith World File no Showing

**URL:** <https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075>\
**Category:** WPF\
**Created:** [September 28, 2011, 5:40am UTC](https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075 "2011-09-28T05:40:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael4](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/michael4/32/24915_2.png) [@Michael4](https://community.thinkgeo.com/u/Michael4)\
**Post date:** [September 28, 2011, 5:40am UTC](https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075/1 "2011-09-28T05:40:31Z")

</div>

I&nbsp;am&nbsp;loading&nbsp;a&nbsp;TIFF&nbsp;using&nbsp;the&nbsp;following&nbsp;code,&nbsp;but&nbsp;the&nbsp;image&nbsp;does&nbsp;not&nbsp;appear.&nbsp;&nbsp;Is&nbsp;there&nbsp;something&nbsp;wrong&nbsp;(maybe&nbsp;with&nbsp;the&nbsp;World&nbsp;File?&nbsp;&nbsp;I&nbsp;downloaded&nbsp;the&nbsp;image&nbsp;from&nbsp;TerraServer&nbsp;and&nbsp;it&nbsp;came&nbsp;with&nbsp;the&nbsp;World&nbsp;File.

`    Private Sub AddRasterImage(ByVal filePath As String, ByVal OverlayKey As String)        Dim worldImageLayer As GdiPlusRasterLayer = New GdiPlusRasterLayer(filePath)        AddHandler (CType(worldImageLayer.ImageSource, GdiPlusRasterSource)).StreamLoading, AddressOf Image_StreamLoading        worldImageLayer.UpperThreshold = Double.MaxValue        worldImageLayer.LowerThreshold = 0        worldImageLayer.IsGrayscale = False        Dim ImageOverlay As LayerOverlay = New LayerOverlay()        ImageOverlay.Layers.Add(OverlayKey & "Layer", worldImageLayer)        WpfMap1.Overlays.Add(OverlayKey & "Overlay", ImageOverlay)        WpfMap1.Overlays.MoveToBottom(WpfMap1.Overlays.IndexOf(ImageOverlay))    End Sub    Private Sub Image_StreamLoading(ByVal sender As Object, ByVal e As StreamLoadingEventArgs)        If e.StreamType = "Image File" Then            Dim stream As IO.Stream = New FileStream(e.AlternateStreamName, FileMode.Open, FileAccess.Read)            e.AlternateStream = stream        End If        If e.StreamType = "World File" Then            Dim fName As String = IO.Path.GetFullPath(e.AlternateStreamName)            Select Case IO.Path.GetExtension(e.AlternateStreamName).ToUpper                Case ".TIF"                    fName = fName.Substring(0, fName.Length - 3) & "tfw"                Case ".JPG"                    fName = fName.Substring(0, fName.Length - 3) & "jgw"            End Select            Dim stream As IO.Stream = New FileStream(fName, FileMode.Open, FileAccess.Read)            e.AlternateStream = stream        End If    End Sub`

The&nbsp;World&nbsp;File&nbsp;contains:

5.648000  
  
0.000000  
  
0.000000  
  
-5.648000  
  
573645.000000  
  
2918226.000000  
  
&nbsp;

If&nbsp;I&nbsp;use:

`        Dim worldImageLayer As GdiPlusRasterLayer = New GdiPlusRasterLayer(filePath, New RectangleShape(-80.26173, 26.38224, -80.1914, 26.31811))`

without&nbsp;streaming,&nbsp;then&nbsp;the&nbsp;image&nbsp;shows&nbsp;up

---

<div class="post-metadata">

**Author:** ![Gary2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/49beb7/32.png) [@Gary2](https://community.thinkgeo.com/u/Gary2)\
**Post date:** [September 28, 2011, 12:59pm UTC](https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075/2 "2011-09-28T12:59:47Z")

</div>

Hello&nbsp;Michael,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thank&nbsp;you&nbsp;for&nbsp;your&nbsp;post.&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;think&nbsp;the&nbsp;key&nbsp;is&nbsp;e.AlternateStream&nbsp;=&nbsp;stream,&nbsp;this&nbsp;is&nbsp;the&nbsp;only&nbsp;different&nbsp;with&nbsp;or&nbsp;without&nbsp;steaming.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Can&nbsp;you&nbsp;debug&nbsp;this&nbsp;part&nbsp;and&nbsp;compare&nbsp;the&nbsp;difference&nbsp;?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Gary

---

<div class="post-metadata">

**Author:** ![Michael4](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/michael4/32/24915_2.png) [@Michael4](https://community.thinkgeo.com/u/Michael4)\
**Post date:** [September 28, 2011, 8:24pm UTC](https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075/3 "2011-09-28T20:24:34Z")

</div>

If&nbsp;I&nbsp;put&nbsp;a&nbsp;debug.print&nbsp;statement&nbsp;before&nbsp;both&nbsp;e.AlternateStream&nbsp;=&nbsp;stream&nbsp;in&nbsp;the&nbsp;streamloading&nbsp;method,&nbsp;I&nbsp;get&nbsp;alternating&nbsp;world&nbsp;file&nbsp;and&nbsp;image&nbsp;file,&nbsp;but&nbsp;still&nbsp;no&nbsp;image&nbsp;on&nbsp;the&nbsp;map.&nbsp;&nbsp;If&nbsp;I&nbsp;zoom&nbsp;in&nbsp;or&nbsp;out,&nbsp;I&nbsp;still&nbsp;see&nbsp;the&nbsp;alternating&nbsp;streaming.

---

<div class="post-metadata">

**Author:** ![Michael4](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/michael4/32/24915_2.png) [@Michael4](https://community.thinkgeo.com/u/Michael4)\
**Post date:** [September 29, 2011, 5:46am UTC](https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075/4 "2011-09-29T05:46:26Z")

</div>

Could&nbsp;it&nbsp;be&nbsp;the&nbsp;different&nbsp;projectons&nbsp;in&nbsp;the&nbsp;world&nbsp;file?&nbsp;&nbsp;For&nbsp;instance,&nbsp;one&nbsp;of&nbsp;my&nbsp;worlld&nbsp;files&nbsp;is:&nbsp;  
&nbsp;Geo-reference&nbsp;Information:&nbsp;&nbsp;  
&nbsp;Projection:&nbsp;Geographic&nbsp;  
&nbsp;Datum:&nbsp;WGS&nbsp;84&nbsp;  
&nbsp;Image&nbsp;Units:&nbsp;Meters&nbsp;  
&nbsp;&nbsp;  
&nbsp;and&nbsp;the&nbsp;oher&nbsp;is:&nbsp;  
&nbsp;Geo-reference&nbsp;Information:&nbsp;&nbsp;  
&nbsp;Projection:&nbsp;UTM&nbsp;Zone&nbsp;17&nbsp;  
&nbsp;Datum:&nbsp;WGS&nbsp;84&nbsp;  
&nbsp;Image&nbsp;Units:&nbsp;Meters&nbsp;

---

<div class="post-metadata">

**Author:** ![Val](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Val](https://community.thinkgeo.com/u/Val)\
**Post date:** [September 29, 2011, 9:40am UTC](https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075/5 "2011-09-29T09:40:25Z")

</div>

Michael,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;Let&nbsp;me&nbsp;interject&nbsp;in&nbsp;the&nbsp;conversation&nbsp;very&nbsp;quick.&nbsp;I&nbsp;am&nbsp;not&nbsp;familiar&nbsp;with&nbsp;the&nbsp;streaming&nbsp;issue&nbsp;but&nbsp;one&nbsp;thing&nbsp;that&nbsp;you&nbsp;need&nbsp;to&nbsp;make&nbsp;sure&nbsp;is&nbsp;to&nbsp;set&nbsp;the&nbsp;MapUnit&nbsp;of&nbsp;your&nbsp;map&nbsp;correctly.&nbsp;If&nbsp;you&nbsp;world&nbsp;file&nbsp;contains&nbsp;values&nbsp;like&nbsp;573645&nbsp;for&nbsp;the&nbsp;x-coordinate&nbsp;of&nbsp;the&nbsp;center&nbsp;of&nbsp;the&nbsp;upper&nbsp;left&nbsp;pixel&nbsp;and&nbsp;2918226&nbsp;for&nbsp;the&nbsp;y-coordinate,&nbsp;then&nbsp;the&nbsp;MapUnit&nbsp;has&nbsp;to&nbsp;be&nbsp;in&nbsp;Meters.&nbsp;The&nbsp;world&nbsp;file&nbsp;itself&nbsp;does&nbsp;not&nbsp;contain&nbsp;projection&nbsp;information,&nbsp;only&nbsp;the&nbsp;coordinates&nbsp;for&nbsp;the&nbsp;image&nbsp;to&nbsp;be&nbsp;placed&nbsp;geographically.&nbsp;([en.wikipedia.org/wiki/World\_file](http://en.wikipedia.org/wiki/World_file))&nbsp;.&nbsp;I&nbsp;just&nbsp;want&nbsp;to&nbsp;make&nbsp;sure&nbsp;we&nbsp;have&nbsp;that&nbsp;well&nbsp;established&nbsp;before&nbsp;trying&nbsp;to&nbsp;find&nbsp;the&nbsp;problem&nbsp;anywhere&nbsp;else.

---

<div class="post-metadata">

**Author:** ![Michael4](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/michael4/32/24915_2.png) [@Michael4](https://community.thinkgeo.com/u/Michael4)\
**Post date:** [September 29, 2011, 9:16pm UTC](https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075/6 "2011-09-29T21:16:22Z")

</div>

Good&nbsp;catch…&nbsp;that&nbsp;is&nbsp;probably&nbsp;the&nbsp;problem.&nbsp;&nbsp;Now&nbsp;the&nbsp;question&nbsp;is,&nbsp;is&nbsp;there&nbsp;a&nbsp;way&nbsp;to&nbsp;use&nbsp;a&nbsp;world&nbsp;file&nbsp;in&nbsp;meters&nbsp;when&nbsp;the&nbsp;map&nbsp;is&nbsp;set&nbsp;as&nbsp;DecimalDegree?&nbsp;&nbsp;Or&nbsp;do&nbsp;I&nbsp;just&nbsp;have&nbsp;to&nbsp;plan&nbsp;on&nbsp;putting&nbsp;the&nbsp;rectangle&nbsp;in?

---

<div class="post-metadata">

**Author:** ![Val](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Val](https://community.thinkgeo.com/u/Val)\
**Post date:** [September 30, 2011, 8:43am UTC](https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075/7 "2011-09-30T08:43:28Z")

</div>

Michael,

&nbsp;No,&nbsp;if&nbsp;your&nbsp;image&nbsp;is&nbsp;in&nbsp;meters,&nbsp;you&nbsp;need&nbsp;to&nbsp;have&nbsp;your&nbsp;map&nbsp;unit&nbsp;also&nbsp;in&nbsp;that&nbsp;unit.&nbsp;Only&nbsp;in&nbsp;some&nbsp;specific&nbsp;situations&nbsp;you&nbsp;can&nbsp;trick&nbsp;an&nbsp;image&nbsp;into&nbsp;Decimal&nbsp;Degrees&nbsp;from&nbsp;Meters.&nbsp;I&nbsp;suggest&nbsp;you&nbsp;look&nbsp;at&nbsp;the&nbsp;sample&nbsp;code&nbsp;_Google&nbsp;Map&nbsp;to&nbsp;Geodetic&nbsp;_&nbsp;so&nbsp;that&nbsp;you&nbsp;get&nbsp;a&nbsp;little&nbsp;more&nbsp;background&nbsp;on&nbsp;the&nbsp;issue.&nbsp;[wiki.thinkgeo.com/wiki/Map\_Suite\_De...o\_Geodetic](http://wiki.thinkgeo.com/wiki/Map_Suite_Desktop_Edition_Projection_Samples#Google_Map_to_Geodetic)

&nbsp;For&nbsp;your&nbsp;question&nbsp;"Do&nbsp;I&nbsp;just&nbsp;have&nbsp;to&nbsp;plan&nbsp;on&nbsp;putting&nbsp;the&nbsp;rectangle&nbsp;in?".&nbsp;I&nbsp;am&nbsp;not&nbsp;sure&nbsp;what&nbsp;you&nbsp;mean.

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [September 30, 2011, 11:38am UTC](https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075/8 "2011-09-30T11:38:39Z")

</div>

Micheal,&nbsp;  
&nbsp;&nbsp;  
&nbsp;As&nbsp;the&nbsp;Val&nbsp;said,&nbsp;the&nbsp;image’s&nbsp;unit&nbsp;should&nbsp;be&nbsp;the&nbsp;same&nbsp;as&nbsp;the&nbsp;map&nbsp;unit&nbsp;and&nbsp;I&nbsp;think&nbsp;the&nbsp;sample&nbsp;project&nbsp;is&nbsp;useful&nbsp;for&nbsp;you.&nbsp;  
&nbsp;&nbsp;  
&nbsp;For&nbsp;your&nbsp;question&nbsp;“Do&nbsp;I&nbsp;just&nbsp;have&nbsp;to&nbsp;plan&nbsp;on&nbsp;putting&nbsp;the&nbsp;rectangle&nbsp;in”,&nbsp;I&nbsp;guessed&nbsp;you&nbsp;talked&nbsp;about&nbsp;the&nbsp;extent&nbsp;for&nbsp;the&nbsp;map,&nbsp;if&nbsp;that,&nbsp;you&nbsp;should&nbsp;set&nbsp;the&nbsp;map’s&nbsp;current&nbsp;extent&nbsp;to&nbsp;the&nbsp;boundingbox&nbsp;of&nbsp;the&nbsp;image&nbsp;to&nbsp;display&nbsp;it.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Scott,

---

<div class="post-metadata">

**Author:** ![Michael4](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/michael4/32/24915_2.png) [@Michael4](https://community.thinkgeo.com/u/Michael4)\
**Post date:** [October 1, 2011, 5:36pm UTC](https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075/9 "2011-10-01T17:36:46Z")

</div>

Thanks&nbsp;Scott&nbsp;and&nbsp;Val.&nbsp;&nbsp;What&nbsp;I&nbsp;meant&nbsp;by&nbsp;the&nbsp;rectangle&nbsp;is&nbsp;that&nbsp;I&nbsp;will&nbsp;not&nbsp;use&nbsp;the&nbsp;world&nbsp;file,&nbsp;but&nbsp;instead&nbsp;just&nbsp;display&nbsp;the&nbsp;image&nbsp;using:&nbsp;  
&nbsp;Dim&nbsp;worldImageLayer&nbsp;As&nbsp;GdiPlusRasterLayer&nbsp;=&nbsp;New&nbsp;GdiPlusRasterLayer(filePath,&nbsp;New&nbsp;RectangleShape(-80.26173,&nbsp;26.38224,&nbsp;-80.1914,&nbsp;26.31811))&nbsp;

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [October 4, 2011, 3:21am UTC](https://community.thinkgeo.com/t/tiffwith-world-file-no-showing/3075/10 "2011-10-04T03:21:07Z")

</div>

Micheal,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;explanations!&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yes,&nbsp;if&nbsp;you&nbsp;have&nbsp;the&nbsp;correct&nbsp;extent&nbsp;value&nbsp;for&nbsp;the&nbsp;image&nbsp;file,&nbsp;you&nbsp;don’t&nbsp;need&nbsp;to&nbsp;use&nbsp;the&nbsp;world&nbsp;file.&nbsp;But&nbsp;you&nbsp;need&nbsp;to&nbsp;set&nbsp;the&nbsp;extent&nbsp;correctly&nbsp;so&nbsp;that&nbsp;the&nbsp;image&nbsp;file&nbsp;display&nbsp;correctly.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;let&nbsp;me&nbsp;know,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Scott,
