Simple point layer

Topics: General Topics
Jan 30, 2007 at 3:48 PM
Hi,

I've been trying to add a simple point layer to a map, and so far I have been successful in getting the points to display, but only in their default "red circle with a black cross" style.

What I want to do is to make the points a simple red, solid-filled circle of say 10px by 10px in size. Is there a way to do this without having to create a PNG file to use as a symbol?

Cheers,

Dylan
Jan 30, 2007 at 4:14 PM
I'm not sure why you want to avoid the .PNG image, you could actually create a nicer looking circle with shading and highlights, etc.

But if you want to do it through code, you could create the Image for the Symbol layer using GDI+ with something like this...

SharpMap.Layers.VectorLayer layerSymbolX = new SharpMap.Layers.VectorLayer("circleSymbol");
Bitmap circle = new Bitmap(20, 20);
Graphics g = Graphics.FromImage(circle);
g.DrawEllipse(new Pen(Color.Red,2), new Rectangle(5,5,15,15));
layerSymbolX.Style.Symbol = circle;
g.Dispose();
Jan 30, 2007 at 4:53 PM
Basically, I wanted to avoid using a PNG image as I wanted to experiment with different styles without having to touch a graphics program. Ultimately, I will probably create "proper" symbols in Photoshop when I am ready for the map to go live, but until then I just want /coloured blobs/ to represent them!

The code you gave me is exactly what I'm looking for at this stage. Cheers.