map size

Topics: SharpMap v0.9 / v1.x
Nov 14, 2008 at 12:42 PM
hi all

iam new to sharpmap
i have downloaded the demo project(sharpmap v0.9)
by using that i have created  web project with my shp files in simple.aspx page and iam not using ajax control
iam using visual web developer 2005
it is working and it is displaying image also
1. but the image is very very small
plz tell me how to increase the size of the image

2. and another problem is labels are also displaying when the image is small,when i zoom the map
labels are not visible
i used the below code to display the labels
SharpMap.Layers.LabelLayer layLabel = new SharpMap.Layers.LabelLayer("AP_2004AC labels");
        layLabel.DataSource = layAP_2004AC.DataSource;
        layLabel.Enabled = true;
        layLabel.LabelColumn = "AC_NAME";
        layLabel.Style = new SharpMap.Styles.LabelStyle();
        layLabel.Style.ForeColor = Color.White;
        layLabel.Style.Font = new Font(FontFamily.GenericSerif, 12);
        layLabel.Style.BackColor = new System.Drawing.SolidBrush(Color.FromArgb(128, 255, 0, 0));
        layLabel.MaxVisible = 90;
        layLabel.MinVisible = 30;
        layLabel.Style.HorizontalAlignment = SharpMap.Styles.LabelStyle.HorizontalAlignmentEnum.Center;
        layLabel.SRID = 4326;
        layLabel.MultipartGeometryBehaviour = SharpMap.Layers.LabelLayer.MultipartGeometryBehaviourEnum.Largest;
map.Layers.Add(layLabel);

plz help me
plz tell me the code for increasing the size of the map and displaying the label

Coordinator
Nov 14, 2008 at 1:37 PM
Hi sanjana
first issue:
map.Size = new System.Drawing.Size(width, height);

second issue may be related to the first so fix that one and retry. Bew aware that there is an algorithm in use which decides whether of not to display labels based on the label priority and its proximitty to labels of higher priority so don't expect all labels to display all the time.. hth jd
Nov 15, 2008 at 10:33 AM
hi john,

where i have mention the size ,in maphelper.cs page or in simple.aspx page
also tell me  the  rangrs of width and height values
Coordinator
Nov 15, 2008 at 12:49 PM
Edited Nov 15, 2008 at 12:51 PM
Hi sanjana
if you are using simple.aspx as a starting point this is the line which sets the size (in the Page_Load method)  

myMap = MapHelper.InitializeMap(new System.Drawing.Size((int)imgMap.Width.Value,(int)imgMap.Height.Value));

as you can see it is setting the size of the map to the size of the element imgMap (an image button in the original markup) so by changing the width and height properties of the imgMap element the size of the rendered image should update accordingly. Or you can set the size explicitly for instance:
myMap = MapHelper.InitializeMap(new System.Drawing.Size(600, 400));
 
Any System.Drawing.Size constructed of positive integers is a valid argument - though GDI performance will degrade at high values and is somewhat dependent on machine spec (GDI is the set of components that do the actual drawing to create the image) - but you should be ok for any reasonable screen resolution.

hth jd