ThinkGeo.com    |     Documentation    |     Premium Support

Problem ShapeFile display

Hello,


Currently I'm testing Map Suite Web Edition.


I try to load an shape file. With the exemple given by the QuickStart Guides, I can load a shape file given in the exemple.


When I try to load a shape file coming from a dwg file, the map is white, and nothing is display.


What can be the problem?



This is the code  that I'm using to load the file.




                  FactoryMap.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"));


FactoryMap.MapUnit = GeographyUnit.DecimalDegree;                  ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(MapPath("~/img/zone_pol.shp"));                 


worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 243, 239, 228), GeoColor.FromArgb(255, 218, 193, 163), 1);


worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;                 


FactoryMap.StaticOverlay.Layers.Add(worldLayer);  




Do i forget something?



Thxxx



Soputhy, 
  
 You didn’t set the CurrentExtent of the map. 
 
         worldLayer.Open()
         Map1.CurrentExtent = worldLayer.GetBoundingBox();
         worldLayer.Close();
 
 If your data is under DecimalDegree, the default extent should work fine. But if your data is under some other projection, you definitely need the above codes to set it manually and need to change the MapUnit to Meter or Inch.  
  
 Also I recommended you enable the mouse Coordinate, that will make you easier to find what the current extent is. 
 Map1.MapTools.MouseCoordinate.Enabled = true; 
  
 Let me know if you have more issues. 
  
 Thanks, 
  
 Ben

Thanks, for your help. 
  
 I forget to set the CurrentExtent of the map.  
 I correct it, but i still can’t show the map. 
  
 In the first time, I think that my shape file is wrong, but when I test with the map suite explorer, I can see the map. 
 After that, I try with the shape file given in the sample. I can show the map in the application.  
  
 Why can I show the shape file given by Map Suite and not a personal shape file? 
  
 I try with adding a “FactoryMap.StaticOverlay.Redraw();” but nothing change.  
  


Soputhy, 
  
 Can you check your aspx file and make sure you are not using “100%” for map’s width and height? Change it to 500px for example and see if it works. There is an html issue that when setting a div’s width to 100%, all the parent’s width should also set to 100% otherwise the div is invisible. If you make your demo by coping the page from our sample, you may have this problem. (We set the parents height to 100% in a css file in our sample so they are fine). 
  
 If your map is still invisible, I’ve no idea what’s going on. Can you send your file/demo to me then and we can create a demo for you.  
  
 Thanks, 
  
 Ben

the width and the height of the map are not setting to 100%. 


I attach the code. The shape file is too be to be attached (he is present at : megaupload.com/?d=QU6CE9EX).


Can it be the reason of the problem?


thanks for your help,



509-ARLI.zip (1.72 KB)




 


Soputhy,


You didn't set the style of the layer, I add this following code and everything is working fine.



worldLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Gray, 1, true);


Thanks,


Ben




Everything is working. 
  
 Thanks for your help.

That’s my pleasure, Soputhy.