This project has moved. For the latest updates, please go here.

GIS Dunce seeks guidance for shapefile data viewing problems

Topics: General Topics
Aug 22, 2006 at 8:17 PM

i can run the sample website provided just fine but it's only when i try to view my shapefile with the demo is whenever i cannot see anything.

my shapefile data DOES come with a PRJ file :


..and I receive no errors whenever the application loads it. I noticed the SRID value and commented it out but it made no difference (not sure as to where to look for the value for my particular data).

i guess I am looking for guidance on saying "If you have this type of data, use this SRD" or "if you have this type of data then use this coordinate transformation". it's late in the afternoon and my lightbulb is dimming....

by the way I do have all of these files that are in the same data directory with the SHP file:


thanks in advance!

Aug 22, 2006 at 11:50 PM
SharpMap doesn't transform a layer unless you tell it to. Try removing the other layers and zoom to the extents of your layer.
Aug 23, 2006 at 12:18 PM
Yes I have tried that with only my shape file loading up (removing all of the other layer code in the sample and keeping this one in) and it still shows only a blank map.

Now as for the extents you are talking about, does the prj file hold this information?

Aug 23, 2006 at 12:23 PM
The Code:

Dim map As SharpMap.Map = New SharpMap.Map(size)

Dim lyrParcels As SharpMap.Layers.VectorLayer = New SharpMap.Layers.VectorLayer("Parcels")
lyrParcels.DataSource = New SharpMap.Data.Providers.ShapeFile(HttpContext.Current.Server.MapPath("App_Data/parcels.shp"), True)
lyrParcels.Style.Outline = Pens.Azure
lyrParcels.Style.EnableOutline = True
lyrParcels.Style.Fill = New SolidBrush(Color.Beige)
lyrParcels.SRID = 4326

map.MaximumZoom = 360
map.BackColor = Color.White
map.Zoom = 360
map.Center = New SharpMap.Geometries.Point(0, 0)

HttpContext.Current.Trace.Write("Map initialized")
Aug 23, 2006 at 2:42 PM
map.ZoomToExtents(); //Zoom to all layers
map.ZoomToBox(myLayer.Envelope); //Zoom to layer
Aug 30, 2006 at 7:04 PM

Just wanted to let you know that the following code produced a map!

map.ZoomToBox(myLayer.Envelope); //Zoom to layer

Thank you so much for all of your help on this!