public string GetPlacesAsJsonString(string googleMapsKey, string datacollectionID, GPoint geoPoint, int zoomLevel, string navigationUrl) { //public static IEnumerable<DataItem> GetPlacesAsJsonString(string googleMapsKey, string datacollectionID, GPoint geoPoint, int zoomLevel) //{ string traceInfo = ""; try { int searchRadius = convertToRadius(zoomLevel); traceInfo = "1"; string where = GetWhere(datacollectionID); traceInfo = "2"; IEnumerable <DataItem> items = BaseCollection <DataItem> .Get(where); traceInfo = "3"; //if (items.Count > 500) //{ // throw new Exception("Er zijn teveel items gevonden die voldoen aan de selectie. Maak de selectie kleiner aub."); //} BaseCollection <DataItem> locations = new BaseCollection <DataItem>(); foreach (DataItem item in items) { double distance = 0; if (GoogleGeocoder.IsWithinDistance(item, geoPoint.Lat, geoPoint.Long, searchRadius, out distance)) { traceInfo = "4"; item.Distance = distance; //RewriteUrl=DrillDownUrl van de location wordt ipv de {RewriteUrl} gezet in js. item.RewriteUrl = item.GetRewriteUrl(navigationUrl, "I"); traceInfo = "5"; locations.Add(item); } } //sorteer de lijst op afstand locations.Sort(delegate(DataItem loc1, DataItem loc2) { return(loc1.Distance.CompareTo(loc2.Distance)); }); //return locations; traceInfo = "6"; string json = ConvertToJson(locations); return(json); } catch (Exception ex) { traceInfo += ex.Message; } return(traceInfo); //return locations.Select(locations.CreateNewStatement("Name, Title")); }