ThinkGeo.com    |     Documentation    |     Premium Support

Display a shape file

I am using the full version of Mapsuite web 3.0, just started. I am trying to display a shapefile, I copied the code from example "Display A SimpleMap, only difference is I used my shape file. Can somebody help me figure out where the problem is?


 


Thank you very much


 


Quinn



541-ShapeFiles.zip (60.2 KB)

Forgot to mention that the shap file cannot be displayed in my application. Please help get me started. 
  
 Quinn

You can add this code into your map where you create your shape file: 
 LayerName.RequireIndex = false;

Truong, 
  
 Thank you for replying. I added this line into my code, the map still not showing. Actually I used MapSuit explorer to create a idx file already, the problem is not index file, it must be something else.

Qingge, 
  
 Welcome to the community, hope you enjoy sharing and learning here! 
  
 Your data is not in DecimalDegree and so the current extent “(-140, 60, 140, -60)”  doesn’t work. Change the code like this and everything will be fine.  
 
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Map1.MapBackground.BackgroundBrush = New GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"))
            Map1.MapUnit = GeographyUnit.Feet

            ’ The following two lines of code enable the client and server caching.
            ’ If you enable these features it will greatly increase the scalability of your
            ’ mapping application however there some side effects that may be counter intuitive.
            ’ Please read the white paper on web caching or the documentation regarding these methods.

            ’ Map1.StaticOverlay.ClientCache.CacheId = “WorldOverlay”
            ’ Map1.StaticOverlay.ServerCache.CacheDirectory = MapPath("~/ImageCache/" + Request.Path)

            Dim worldLayer As New ShapeFileFeatureLayer(“C:\shapefiles\aldata\mnsfield.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
            Map1.StaticOverlay.Layers.Add(worldLayer)

            worldLayer.Open()
’ set the current extent to layer’s boundingbox
            Map1.CurrentExtent = worldLayer.GetBoundingBox()
            worldLayer.Close()

        End If
    End Sub
 
 Here is a quick trick that to check if a shape file is correct, just drag and drop it to Map Suite Explorer (along with the product) and see if it shows well there.  
  
 Thanks, 
  
 Ben