ThinkGeo.com    |     Documentation    |     Premium Support

Beginner's help : cannot see the map

Hi

I try to make a small sample with my map. As I don't know the extent of the map I take it from the shapefile :


      themap.MapUnit = GeographyUnit.Meter;

      ShapeFileFeatureLayer lay= new ShapeFileFeatureLayer("A.shp");

      lay.RequireIndex = false;

      themap.StaticOverlay.Layers.Add(lay);

      themap.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;

      themap.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

      lay.Open();

      themap.CurrentExtent = lay.GetBoundingBox();

      themap.Refresh();


There is no error but the map does not display. Thanks for any help.

(ps map attached)



383-A.zip (641 Bytes)

Try this: 
  
 themap.MapUnit = GeographyUnit.DecimalDegree; 
 layer = new ShapeFileFeatureLayer(“A.shp”); // Get this path right… for a test, try the full path if nothing loads just to be sure this isn’t the problem 
 layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1; 
 layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; 
 layer.RequireIndex = false; // You really want to build an index for any normal sized shape file… this is a huge performace boost. 
 themap.StaticOverlay.Layers.Add(“LayerName”, layer); 
 themap.Refresh();

btw… If this is the only file that you are loading, then you won’t need to set the extent.

Thanks a lot for your sample. Actually my mistake was to set ZoomLevelSet.ZoomLevel01 to the map instead of the layer ! 
 But for the extent I really need to set it, because if not I can see only a part of the map. 
  
 Thanks

great stuff… you probably do, but make sure that you have the correct MapUnit (meter / decimal degrees). nJoy

Riccardo, 
  
 Thanks for joining the forum and hope you enjoy learning and sharing here. 
  
 Brendan, as usual, thanks for the sharing :) 
  
 Ben 


Thanks for your help. I appreciate the software and the community.

That’s great! Feel free to let us know if we can make your coding easier. 
  
 Ben