I'm trying to use a query task against a local datasource (mpk) and it seems to only return the first 1000 features. Is there a way to change this?
Hi Mark,The default MaxRecords property is 1000 and can be changed by setting the MaxRecords property of the LocalMapService. The MaxRecords property cannot be set when the LocalMapService is running so it will need to be set before the service has started or by stopping and then starting the service.
_localMapService = new LocalMapService()
{
Path = "..\\..\\..\\Data\\MPKS\\USCitiesStates.mpk",
MaxRecords = 500000
};
_localMapService.Start();
Once the MaxRecords property has been set and the service started you can use it in the QueryTask by specifying the QueryTask.Url property as the LocalMapService.Url property.
QueryTask queryTask = new QueryTask();
queryTask.Url = _localMapService.Url + "/0";
queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
queryTask.Failed += QueryTask_Failed;
Query query = new ESRI.ArcGIS.Client.Tasks.Query();
query.OutFields.AddRange(new string[] { "STATE_NAME", "POP2000" });
query.Geometry = args.Geometry;
query.ReturnGeometry = true;
queryTask.ExecuteAsync(query);
Since beta 1 release we�??ve added the ability to set the MaxRecords property via an overload on the convenience method GetService and GetServiceAsync on LocalMapService. This functionality will be available in beta 2 later on in the year. CheersKerrie