You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mapi...@googlegroups.com
Hi Group,
Is there any Out of the Box search tool available in MapXtreme, which can be used in MapXtreme web application. We are trying to provide search functionality to the Web Application. Any help would be highly appreciated.
Regards, Deepak
Mustafa ÖZÇETiN
unread,
Jul 30, 2012, 4:30:58 AM7/30/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mapi...@googlegroups.com
You must implement your own find tool. There is a sample app. in MapXtreme documentation named "Find". To start, you may examine this sample.
Also I can give some code snippets in C# that may be helpful. Assume that we want to write a "find street" tool in a MX web app. For that, we must write:
1) Client side (e.g. JavaScript/AJAX) code to send a parameter (e.g. street id to find) to the server 2) A FindStreet command deriving from MapBaseCommand 3) A method that will perform the actual find
process, namely findStreet() below
In my implementations, I always use unique object IDs for all objects in my layers. When I, for instance, want to find a street, I get its id from the client side with JavaScript and send it to the server via a get or AJAX request. Such a request address can be
var url = "HttpHandlers/HndStreetQuery.ashx?streetId="+streetId;
in the JavaScript code, which must be sent to an Http Handler, namely HndStreetQuery.ashx
In the server side, your find command may be like:
[Serializable] public class FindStreet : MapBaseCommand { public FindStreet() { Name = "FindStreet"; }
public override void Process() { string streetId = HttpContext.Current.Request.QueryString["streetId"];
MapUtils.findStreet(Convert.ToInt32(streetId)); MapControlModel model = MapControlModel.GetModelFromSession(); MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); StreamImageToClient(ms); } }
The streetId variable here is the one coming from the client streetId parameter.
With regard to the find method, it may be something like:
public static void findStreet(int id) { Map map = Session.Current.MapFactory[0]; FeatureLayer findLayer = (FeatureLayer)map.Layers["STREET_LAYER"]; Find find = new Find(findLayer.Table, findLayer.Table.TableInfo.Columns["ID"]); FindResult result = find.Search(id.ToString()); if (result.ExactMatch) {
map.Center = new DPoint(result.FoundPoint.X, result.FoundPoint.Y); Distance d = new Distance(0.15, map.Zoom.Unit); map.Zoom = d; } }
Finally, I strongly recommend you to read the chapter "Web Applications, Controls, and Tools" in the MapXtreme Developer Guide document. This chapter explains the request/response cyle step by step.
Regards,
Mustafa ÖZÇETiN Senior Researcher The Scientific and Technological Council of Turkiye Ankara /
Turkiye