Best Industrial Training in C,C++,PHP,Dot Net,Java in Jalandhar

Tuesday, 28 February 2012

Source code of google map in asp.net

Place google map key in web config file
example:
After </system.web> tag
<appSettings>
        <add key="googlemaps.subgurim.net" value="ABQIAAAA9962__pKzjVwwD2OKjGyvBTqD8KII8nGCHEOs63QpaP31mkaURSGwkaJxV2dbdG8nnV83KE_FGQ_vg"/>
    </appSettings>

 string strFullAddress;
string address="punjab";
            string sMapKey = ConfigurationManager.AppSettings["googlemaps.subgurim.net"];
            Subgurim.Controles.GeoCode GeoCode;
            strFullAddress = address + ". "  + ". " + "India";
            GeoCode = GMap1.geoCodeRequest(strFullAddress);
            Subgurim.Controles.GLatLng gLatLng = new Subgurim.Controles.GLatLng(GeoCode.Placemark.coordinates.lat, GeoCode.Placemark.coordinates.lng);

            GMap1.setCenter(gLatLng, 16, Subgurim.Controles.GMapType.GTypes.Normal);
            Subgurim.Controles.GMarker oMarker = new Subgurim.Controles.GMarker(gLatLng);
            GMap1.addGMarker(oMarker);

No comments:

Post a Comment