コード例 #1
0
        static string rev_localizacion(string coor)
        {
            string       url    = url_api_rev + coor + url_key + apikey;
            var          json   = new WebClient().DownloadString(url);
            geo_response r_json = JsonConvert.DeserializeObject <geo_response>(json);

            if (r_json.status == "OK")
            {
                string info       = r_json.results[0].formatted_address;
                string cordenadas = r_json.results[0].geometry.location.lat + "  /  " + r_json.results[0].geometry.location.lng;
                return(info);
            }
            else
            {
                return(json);
            }
        }
コード例 #2
0
        static string localizacion(string dir)
        {
            string       url    = url_api + dir.Replace(" ", "+") + url_key + apikey;
            var          json   = new WebClient().DownloadString(url);
            geo_response r_json = JsonConvert.DeserializeObject <geo_response>(json);
            //string info;
            string coordenadas;

            if (r_json.status == "OK")
            {
                //info = r_json.results[0].formatted_address;
                //coordenadas = r_json.results[0].geometry.location.lat + "--" + r_json.results[0].geometry.location.lng;
                //coordenadas = iframe + url_mapa + url_key + apikey + url_mapa_center + "-33.8569,151.2152" + url_mapa_zoom + "&maptype=satellite\"> </iframe>";
                coordenadas = iframe + url_mapa + url_key + apikey + url_mapa_center + r_json.results[0].geometry.location.lat + "," + r_json.results[0].geometry.location.lng + url_mapa_zoom + "\" style=\"width: 100 %; border: 0\" height=\"300\" ></iframe>";
                return(coordenadas);
//              info = "< script type = " + "text/javascript"+" > function initMap() {const myLatLng = { lat: -25.363, lng: 131.044 };const map = new google.maps.Map(document.getElementById("+"map"+"), {zoom: 4,center: myLatLng,})new google.maps.Marker({position: myLatLng,map, title: "+"Hello World!"+",});}</script> ";
//              return info;
            }
            else
            {
                return(json);
            }
        }