hilite query in c#

Tamas Szekeres szekerest at GMAIL.COM
Sat May 26 16:54:47 EDT 2007


Hi,

Here's a code fragment from one my earlier projects that might be
relevant for your intents.

string qstring = "MyQueryString";
layerObj layer = map.getLayer(0);

layer.open();
string qs = "";
string att = "";
for (int i=0; i < layer.numitems; i++)
{
	if (qs == "")
	{
		qs = "(";
		att = layer.getItem(i);
	}
	else
	{
		qs += " OR ";
	}
	qs += "'[" + layer.getItem(i) + "]'='" + qstring + "'";
}
qs += ")";
layer.close();

try
{
	layer.queryByAttributes(map, att, qs, 1);
}
catch (Exception e)
{
	Trace.WriteLine(e.Message);
}

using(imageObj image = map.drawQuery())
{
	//image.save("mapimg.png",map);
	byte[] img = image.getBytes();
	using (MemoryStream ms = new MemoryStream(img))
	{
		mapPictureBox.Image = Image.FromStream(ms);
	}
}

I haven't tested this with the recent versions though.

Best regards,

Tamas


2007/5/26, Veera S.Davan <veeraswamyd at yahoo.co.in>:
> i have displayed a map in imagebutton
> i have wriiten code for identity
> its working
> now i want code for locatebyattributesin c# ie
> when user selects a layer and sublayer from dropdownlists and enters a value
> in the textbox then related features must be highlighted on the map
> plz tell me the code in c#
>



More information about the mapserver-users mailing list