(一)创建一简单地图

SharpMap.Map myMap = new SharpMap.Map(new Size(400,300));
myMap.MinimumZoom = 100; //Minimum zoom allowed
myMap.BackgroundColor = Color.White; //Set background
myMap.Center = new SharpMap.Geometry.Point(725000, 6180000); //Set center of map
myMap.Zoom = 1200; //Set zoom level
myMap.Size = new System.Drawing.Size(300,200); //Set output size

//Add PostGIS layer:
SharpMap.Layers.VectorLayer myLayer = new SharpMap.Layers.VectorLayer("My layer");
string ConnStr = "Server=127.0.0.1;Port=5432;UserId=postgres;Password=password;Database=myGisDb;";
// v0.9 SharpMap.Data.Providers 不包含PostGIS

myLayer.DataSource = new SharpMap.Providers.PostGIS(ConnStr, "myTable", "the_geom", 32632);


myLayer.MaxVisible = 40000;
myMap.Layers.Add(myLayer);

//Render the map
System.Drawing.Image imgMap = myMap.GetMap();

 

备注:

你可能感兴趣的:(创建)