Exemple #1
0
        private void fetch()
        {
            Response.Clear();
            SpotInfo sinfo = new SpotInfo();

            String key = Request["key"];

            sinfo.Address = key;
            Geocoder   geo    = new Geocoder();
            GeoResult  result = geo.GetGeoResult(sinfo);
            JsonObject jobj   = new JsonObject();

            if (GeoResultStatus.OK.Equals(result.Status))//@since 0.1.1
            {
                jobj.NameValuePair.Add(new JsonObject.nvpair()
                {
                    Name = "lat", Value = result.Results[0].Geometry.Location.Lat
                });
                jobj.NameValuePair.Add(new JsonObject.nvpair()
                {
                    Name = "lng", Value = result.Results[0].Geometry.Location.Lng
                });
            }
            AjaxResponse jresponse = new AjaxResponse();

            jresponse.Status  = "OK";
            jresponse.RawData = jobj;
            jresponse.Msg     = "lat, lng of " + key;
            Response.Write(jresponse.ToString());
            Response.ContentType = "application/json";
        }