# Problem Loading Image

**URL:** <https://community.thinkgeo.com/t/problem-loading-image/4153>\
**Category:** MVC\
**Created:** [March 17, 2014, 1:49am UTC](https://community.thinkgeo.com/t/problem-loading-image/4153 "2014-03-17T01:49:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vincent](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e9bcb4/32.png) [@Vincent](https://community.thinkgeo.com/u/Vincent)\
**Post date:** [March 17, 2014, 1:49am UTC](https://community.thinkgeo.com/t/problem-loading-image/4153/1 "2014-03-17T01:49:06Z")

</div>

Dear&nbsp;Support&nbsp;Team,  
  
  
  
The&nbsp;code&nbsp;below&nbsp;for&nbsp;loading&nbsp;tiff&nbsp;image&nbsp;is&nbsp;working&nbsp;well&nbsp;on&nbsp;the&nbsp;development&nbsp;machine.&nbsp;But&nbsp;when&nbsp;the&nbsp;application&nbsp;is&nbsp;moved&nbsp;to&nbsp;deployment&nbsp;machine,&nbsp;the&nbsp;image&nbsp;does&nbsp;not&nbsp;load&nbsp;and&nbsp;an&nbsp;error&nbsp;message&nbsp;"Parameter&nbsp;is&nbsp;not&nbsp;valid"&nbsp;appears.  
  
  
  
Code&nbsp;for&nbsp;rendering&nbsp;on&nbsp;the&nbsp;view

> `@Html.ThinkGeo().Map("Map1", System.Web.UI.WebControls.Unit.Percentage(100), 700)`  
> `          ``.MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromHtml("#ffffff"))))`  
> `          ``.CurrentExtent(catersion.Xmin, catersion.Ymax, catersion.Xmax, catersion.Ymin)`  
> `          ``//.ZoomExtentTo(catersion.Xmin,catersion.Ymax,catersion.Xmax,catersion.Ymin);`  
> `          ``.MapUnit(GeographyUnit.Feet)`  
> `           ``.MapTools(tools =>`  
> `            ``{`  
> `                ``tools.MouseCoordinateMapTool().Enabled(true); `  
> `               `&nbsp;  
> `            ``})`  
> `            ``.CustomOverlays(overlay =>`  
> `            ``{`  
> `                ``overlay.LayerOverlay("Image").IsVisible(true).Name("Image").IsBaseOverlay(false);`  
> `                ``overlay.LayerOverlay("Pipes").IsVisible(true).Name("Pipes").IsBaseOverlay(false);`  
> `                ``overlay.SimpleMarkerOverlay("Customer_Point").IsVisible(true).Name("Customer_Point").IsBaseOverlay(false);`  
> `                ``overlay.LayerOverlay("ScaleBar").IsVisible(true).Name("ScaleBar").IsBaseOverlay(false);`  
> `             ``})`  
> `          `&nbsp;  
> `          ``.Render();`  
> `        ``});`  
> `        `&nbsp;  
> `      `&nbsp;

  
Code&nbsp;for&nbsp;Server&nbsp;requesting  
  

> `// Server requesting done on page load`  
> `          ``Map1.ajaxCallAction('@ViewContext.RouteData.Values["Controller"].ToString()', "SetBackground", { type: "" }, function (result) {`  
> `            `&nbsp;  
> `             ``redrawMap("Image");`  
> `         ``})`

  
Codes&nbsp;for&nbsp;server&nbsp;processing  
  

> `[MapActionFilter]`  
> `         ``public  String SetBackground(Map map, GeoCollection<``object``> args) {`  
> `           ``Open(map);  //set Map instance for the base class`  
> `           ``SetImage();`  
> `           ``return "";`  
> `        ``}`

  
Set&nbsp;Imge&nbsp;Method  
  

> `public void SetImage() {`  
> `          ``// GetPanel():return Map instance from ajaxcall   `  
> `           ``RectangleShape extent = Web.Layers.MultiGeoRasterLayer.BuildReferenceFile(GetProperty("root")+"Resources/Map/Image/referenceFile.txt", GetProperty("root")+"Resources/Map/Image/");`  
> `            ``Web.Layers.MultiGeoRasterLayer multiGeoRasterLayer = new Web.Layers.MultiGeoRasterLayer(GetProperty("root")+"Resources/Map/Image/referenceFile.txt");`  
> &nbsp;  
> `            ``LayerOverlay images = GetPanel().CustomOverlays["Image"] as LayerOverlay;`  
> `            ``images.Layers.Add(multiGeoRasterLayer);`  
> &nbsp;  
> `      ``}`

  
Code&nbsp;for&nbsp;image&nbsp;layer&nbsp;redraw  
  

> `function redrawMap(name) {`  
> `    ``var layerList = Map1.layers;`  
> `    ``for (var layerCounter = 0; layerCounter < layerList.length; layerCounter++) {`  
> `        ``var eachLayer = layerList[layerCounter];`  
> `        ``if (eachLayer.name==name) {`  
> `            ``eachLayer.redraw(true);               `  
> `        ``}`  
> `    ``}     `  
> `}`

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [March 18, 2014, 1:22am UTC](https://community.thinkgeo.com/t/problem-loading-image/4153/2 "2014-03-18T01:22:41Z")

</div>

Hi&nbsp;Vincent,&nbsp;  
&nbsp;&nbsp;  
&nbsp;If&nbsp;the&nbsp;code&nbsp;works&nbsp;for&nbsp;you&nbsp;in&nbsp;your&nbsp;development&nbsp;machine,&nbsp;but&nbsp;not&nbsp;works&nbsp;in&nbsp;deployment&nbsp;machine,&nbsp;that&nbsp;maybe&nbsp;caused&nbsp;by&nbsp;dll&nbsp;lost.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Have&nbsp;you&nbsp;installed&nbsp;"Map&nbsp;Suite&nbsp;Unmanaged&nbsp;Dependencies&nbsp;7.0.x.x.msi"&nbsp;in&nbsp;your&nbsp;deployment&nbsp;machine?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don
