Ejemplo n.º 1
0
        public cGeoCoder(string StreetAddress, string Town, string Country)
        {
            try
            {
                string FullAddress = StreetAddress + ". " + Town + ". " + Country;
                //string sMapKey = "ABQIAAAASxtC6aF3X8Yduz285l4ARRTlVViOkHY_dKOjlNl-N3o0umkYTxSEF7047wST9i1Xzh4CBoq-vGTuKg";
                string sMapKey = "ABQIAAAAYzWHj1VUYr87CfEy1ncZJxTAmcgP--YQ8_3z8Bko4NEx9oDvexQWRry8Gb8yUFURSyS6nOf4i1NSvw";


                Subgurim.Controles.GeoCode geocode = new Subgurim.Controles.GeoCode();
                Subgurim.Controles.GMap    gmap1   = new Subgurim.Controles.GMap();

                geocode = gmap1.getGeoCodeRequest(FullAddress, sMapKey);
                Subgurim.Controles.GLatLng gLatLng = new Subgurim.Controles.GLatLng(geocode.Placemark.coordinates.lat, geocode.Placemark.coordinates.lng);
                if (geocode != null)
                {
                    pLatitude  = geocode.Placemark.coordinates.lat;
                    pLongitude = geocode.Placemark.coordinates.lng;
                }

                gmap1.setCenter(gLatLng, 16, Subgurim.Controles.GMapType.GTypes.Normal);
                Subgurim.Controles.GMarker oMarker = new Subgurim.Controles.GMarker(gLatLng);
                //Dim oMarker As New Subgurim.Controles.GMarker(gLatLng)
                //gmap1.addGMarker(oMarker);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        /*
         * Add a google map pointing to the selected location
         */
        private void addGMap(Location loc)
        {
            String sMapKey = ConfigurationManager.AppSettings["googlemaps.subgurim.net"];

            Subgurim.Controles.GLatLng gLatLng = new Subgurim.Controles.GLatLng(loc.Latitud, loc.Longitude);

            GMap1.setCenter(gLatLng, 12, Subgurim.Controles.GMapType.GTypes.Hybrid);
            Subgurim.Controles.GMarker marker = new Subgurim.Controles.GMarker(gLatLng);
            GMap1.addGMarker(marker);
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack == false)
            {
                string longitude = (FormView1.FindControl("LongitudeLabel") as Label).Text;
                string latitude  = (FormView1.FindControl("LatitudeLabel") as Label).Text;
                string rua       = (FormView1.FindControl("RuaLabel") as Label).Text;
                string cp        = (FormView1.FindControl("CodigoPostalLabel") as Label).Text;
                string cidade    = (FormView1.FindControl("LocalidadeLabel") as Label).Text;
                string pais      = (FormView1.FindControl("PaisLabel") as Label).Text;

                string endereco = rua + ". " + cp + " " + cidade + ". " + pais;
                Subgurim.Controles.GeoCode geoCode = GMap1.getGeoCodeRequest(endereco);
                Subgurim.Controles.GLatLng gLatLng = new Subgurim.Controles.GLatLng(geoCode.Placemark.coordinates.lat, geoCode.Placemark.coordinates.lng);
                GMap1.setCenter(gLatLng, 16, Subgurim.Controles.GMapType.GTypes.Satellite);
                Subgurim.Controles.GMarker marcador = new Subgurim.Controles.GMarker(gLatLng);
                GMap1.Add(marcador);
            }
        }