为了自由,幸福而不断奋斗,前行!!!

一笑看风云过....

博客园 首页 新随笔 联系 订阅 管理

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();

 

备注:

posted on 2008-08-13 15:28  YAO'STAR  阅读(604)  评论(1编辑  收藏  举报