Template

Topics: Algorithms, SharpMap v0.9 / v1.x
Aug 8, 2007 at 2:35 PM
Can you send me a template or example about drawing a point(latitude,longtitude) on an image by Sharpmap.?.Because we don't have more time to complete this problem in our project , so we need your help much.
Aug 8, 2007 at 8:03 PM
What you need to do is create a collection of primitive geometry, add your point to that collection, create a provider based on your collection of geometry, and then a layer based on that provider. The code below is snipped from the wiki article mentioned elsewhere and slightly modified for clarity of purpose.

SharpMap.Layers.VectorLayer VLayer = new VectorLayer("GeometryLayer");

Collection<SharpMap.Geometries.Geometry> GeomColl = new Collection<SharpMap.Geometries.Geometry>();
//Add a single Point
GeomColl.Add(new SharpMap.Geometries.Point(X,Y));

VLayer.DataSource = new SharpMap.Data.Providers.GeometryProvider(GeomColl);


In the above template, X is your longitude and Y is your latitude.