!"#
$
%
&
'
(
%"
)(%*+(,-.'/01234
1.How do I create a map?
56778
SharpMap.Map myMap = new SharpMap.Map(new Size(400,300));
myMap.Size = new System.Drawing.Size(300,200); //Set output size
myMap.MinimumZoom = 100; //Minimum zoom allowed
myMap.BackgroundColor = Color.White; //Set background
myMap.Center = new SharpMap.Geometry.Point(725000, 6180000); //Set center of map
//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;";
myLayer.DataSource = new SharpMap.Data.Providers.PostGIS(ConnStr, "myTable", "the_geom",
32632);
myLayer.MaxVisible = 40000;
myMap.Layers.Add(myLayer);
//Render the map
////1st possibility: Set zoom level
//myMap.Zoom = 1200; //Set zoom level
//2nd. possibility: Zoom to extents
myMap.ZoomToExtents();
System.Drawing.Image imgMap = myMap.GetMap();
"8
$!%! '! $!#9:!
2.Transforming between image coordinates and world coordinates
$;!
-'9.9747
5-8
SharpMap.Geometries.Point p = myMap.ImageToWorld(new System.Drawing.PointF(x, y));
'6;'$$
:!
57-58
System.Drawing.PointF p = myMap.WorldToImage(new SharpMap.Geometries.Point(34.225,
175.432));
3.Creating a clickable map
System.Windows.Forms
5 <9-!,!
;!#9!8$!5=$!($.4>
$;' <9!
$;'7!
评论3
最新资源