ThinkGeo.com    |     Documentation    |     Premium Support

Problem Loading Image

Dear Support Team,



The code below for loading tiff image is working well on the development machine. But when the application is moved to deployment machine, the image does not load and an error message “Parameter is not valid” appears.



Code for rendering on the 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); 
                
            })
            .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);
             })
           
          .Render();
        });
         
       

Code for Server requesting


// Server requesting done on page load
          Map1.ajaxCallAction(’@ViewContext.RouteData.Values[“Controller”].ToString()’, “SetBackground”, { type: “” }, function (result) {
             
             redrawMap(“Image”);
         })

Codes for server processing


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

Set Imge 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”);
 
            LayerOverlay images = GetPanel().CustomOverlays[“Image”] as LayerOverlay;
            images.Layers.Add(multiGeoRasterLayer);
 
      }

Code for image layer 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);               
        }
    }     
}


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