Topics: SharpMap v0.9 / v1.x, SharpMap v2.0, Web Controls
Dec 1, 2008 at 10:55 AM
How to draw a line using 


VectorRenderer  methodes.


Dec 1, 2008 at 1:27 PM
Edited Dec 1, 2008 at 1:27 PM

Hi vittal, in general you do not use a VectorRenderer directly. VectorRenderer is used internally to draw a collection of geographic features on a layer.
So to draw a line you would:
Create a SharpMap.Geometries.LineString
Add it to a SharpMap.Data.Providers.GeometryProvider
which would be set as the DataSource property for a VectorLayer
Which would be added to the Layers collection of a Map
and then you would call the GetMap() method of the map

If you wanted to draw non geographic things over the map you would use a GDI graphics object obtained from the map image
Image im = map.GetMap();
Graphics g = Graphics.FromImage(im);



Dec 2, 2008 at 11:30 AM
thanks for u r reply.

right now i can able to use graphics class.
i am using VectorRenderer class
functions DrawLabel,and DrawPoint but these are not displaying anything on the map
can u help me in this.
Dec 2, 2008 at 12:13 PM
You shouldnt use the VectorRenderer class directly - to create a Label you need to
create a Feature  --add to--> FeatureProvider --assign to datasource of--> LabelLayer --add to layers collection of--> Map  
and to add a Point you need to
create a Point  --add to--> GeometryProvider --assign to datasource of--> VectorLayer --add to layers collection of--> Map

hth jd
Dec 3, 2008 at 2:16 PM
can u tell me how to insert the point in the shape file database
Dec 3, 2008 at 2:49 PM
You can only write shapefiles using v2 (from http://sharpmapv2.googlecode.com) there is a demo called FeatureExporter which should get you started with writing shapefiles. hth jd
Dec 4, 2008 at 11:59 AM
i am using sharpmap v 0.9 dll it is not containing the shapefileprovider class
can u have new shapemap dll or how to add shapefile namespace to existing sharpmap dll
Dec 4, 2008 at 1:06 PM
It is not possible to write a shapefile with 0.9 alone. You would need to use Net Topology Suite and convert between the native geometry types of each library.
ShapeFileProvider only exists in v2, the nearest thing in 0.9 is System.Data.Providers.Shapefile,  but it doesn't support writing shapefiles
Dec 4, 2008 at 2:07 PM
i want to use Sharpmap V2.0 for creating shape files
 i donot have v2.0 dll right now i am using v 0.9 dll and Net Topogly
for loading the shape files and getting feature related data.
but now i want to create shape file
with v 0.9 i am unable to create the New Shapefile.