ThinkGeo.com    |     Documentation    |     Premium Support

Displaying a custom map with jpg and jgw files

Hi,

I'm a beginner in Map Suite. I have to make an upgrade from an application with Map Suite, but the web edition. Now, I'm switching to WPF version, and the API is completely different.

In my program, I have to display a map in jpg file, associated with a jgw file. I tried to make a LayverOvertlay, and use the GdiPlusRasterLayer, but it doesn't work. Moreover, should the CurrentExtent from the map object is the part of the map visible??? In the previous code in asp.net, it was written Map1.CurrentExtent = geocodeOverlay.GetBoundingBox();

In WPF version, there is no such method. How should I proceed? I'm not sure I understood well all the concepts. Should I have to load a "sh" file in all cases?


 



Alexandre, 
  
 I am not sure what’s “it dones’t work” mean, is it throw exception or it shows nothing? 
  
 Following is a sample codes for displaying a jpg: 
  
 
            wpfMap1.MapUnit = GeographyUnit.DecimalDegree;
            wpfMap1.CurrentExtent = new RectangleShape(-118.098, 84.3, 118.098, -84.3);
            wpfMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);

            GdiPlusRasterLayer sidImageLayer = new GdiPlusRasterLayer(@"…\SampleData\Data\world.jpg");
            sidImageLayer.UpperThreshold = double.MaxValue;
            sidImageLayer.LowerThreshold = 0;

            LayerOverlay staticOverlay = new LayerOverlay();
            staticOverlay.Layers.Add("SidImageLayer", sidImageLayer);
            wpfMap1.Overlays.Add(staticOverlay);

            wpfMap1.Refresh();
 
  
 Also please be careful about the MapUnit, if your image is not in DecimalDegree, please use the correct unit.  
  
 If it still can’t work, please show us your codes, and print out the values of Map.CurrentExtent. 
  
 Thanks, 
  
 Ben