Can't display .shp in map window?

Oct 5, 2012 at 8:26 PM

Hi everyone

I'm new to programming and trying to learn GIS development.

I'm runing MapWindowGIS V4.8.6 in VB 2008 and trying to follow the tutorial to create a simple GIS web app.

This is my code, the map control has been added to the form and thelocation of the .shp is correct...

Public Class Form1 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 

Dim myWorldShape As New MapWinGIS.Shapefile 

myWorldShape.Open("C:\Program Files\MapWindow\Sample Projects\United     States\cities.shp")

AxMap1.AddLayer(myWorldShape, True)

 End Sub
End Class

The project compiles and runs but the map window displays blank without any spatial data. What is it I'm doing wrong?!



Oct 8, 2012 at 6:34 AM

Most methods return true or false. If you check that and show the error message it will help you a lot.

Your code would be like this:

If Not myWorldShape.Open() Then
End If

And I would suggest to name your variable more wisely.
You're opening a shapefile not a shape so name you variable myWorldShapefile