145mb Shape File

Topics: General Topics
Nov 12, 2006 at 5:01 PM
I just started using Sharpmap today and am having some problems getting any map to show. I have a 145mb Shape File of the streets of NY. It takes about 5 minutes to load, the form comes up, but I dont see anything. Here is my code so far if anyone can help me out and tell me what I'm doing wrong. Im coding in Visual Studio 2005 in c#.

SharpMap.Map myMap = new SharpMap.Map(new Size(400, 300));
myMap.MinimumZoom = 100;
myMap.BackColor = Color.White;
myMap.Center = new SharpMap.Geometries.Point(0,0);
myMap.Zoom = 1200;
myMap.Size = new System.Drawing.Size(300, 200);

SharpMap.Layers.VectorLayer myLayer = new SharpMap.Layers.VectorLayer("Layer");
myLayer.DataSource = new SharpMap.Data.Providers.ShapeFile(@"F:\NYSTREETS\Street_Public.shp");

System.Drawing.Image imgMap = myMap.GetMap();
Map1.Image = imgMap;
Nov 14, 2006 at 4:40 PM
Is there anyone that can help me with what i'm doing wrong here?
Nov 14, 2006 at 7:29 PM

myMap.Center = new SharpMap.Geometries.Point(0,0);
you are setting the coordinates of the mapcenter to x=0/y=0 or lat=0°/lon=0° (depending on which coordiante system you are using).
I'm not familiar with the coordinate systems used in the US, but I don't suppose that the streets of NY (New York?) have their center at 0/0.

Nov 14, 2006 at 10:36 PM
From the performance I've seen (just drawing a county sized shapefile), I suspect that is the speed it will take for a 145MB file.

I noticed the performance was quite a bit faster running a map outside of the VS2005 debugger. Try that.

Also, I believe the Alpha release (see Releases at the top) is faster still as the shapefile code is being re-worked.
Nov 15, 2006 at 2:48 PM
Is there a stored procedure that automatically finds the center or sets the map to initially fit inside the viewable form?
Nov 16, 2006 at 6:50 AM

zoom to full extent:

zoom to extent of layer:
map.ZoomToBox( map.Layers0.Envelope );