Javascript & JQuery & CSS > Google Maps API + ÁÖ¼Ò¸¦ ÀÌ¿ëÇÑ À§Ä¡Á¤º¸ »Ì±â
µî·ÏÀÏ : 2017-07-14 17:12
Á¶È¸¼ö : 53,097
ÁÖ¼Ò¸¦ ÀÌ¿ëÇÑ ±×±Û ¸Ê Ç¥½Ã ¹æ¹ý°ú, À§µµ/°æµµ¸¦ »Ì´Â ¼Ò½º ÀÔ´Ï´Ù.
var GreenIcon = new google.maps.MarkerImage(
"http://ankyu.entersoft.kr/images/choiankyu.jpg",
new google.maps.Size(60, 60),
new google.maps.Point(0, 0),
new google.maps.Point(6, 20));
//ÁÖ¼Ò·Î ÁöµµÇ¥½Ã
function codeAddress()
{
var address = "Àü¶óºÏµµ °íⱺ °øÀ½¸é ±¸¾Ï¸® 450-4";
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(37.52,126.92);
var myOptions = {zoom: 19, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP };
var map = new google.maps.Map(document.getElementById("map"), myOptions);
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
$("#setPosition").html(results[0].geometry.location.toString());
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
icon: GreenIcon,
info: '¸»Ç³¼± ÀÔ´Ï´Ù.', // ¸»Ç³¼± ¾È¿¡ µé¾î°¥ ³»¿ë.
title : address,
position: results[0].geometry.location
});
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
function codeAddr()
{
var address = "Àü¶óºÏµµ °íⱺ °øÀ½¸é ±¸¾Ï¸® 450-4";
geocoder1 = new google.maps.Geocoder();
geocoder1.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
t_location = results[0].geometry.location.toString();
t_location = t_location.replace("(","");
t_location = t_location.replace(")","");
t_location = t_location.replace(" ","");
t_location = t_location.split(",");
t_latitude = t_location[0]; //À§µµ
t_longitude= t_location[1]; //°æµµ
$("#setPosition").html("Latitude: " + t_latitude + ", Longitude: " +t_longitude);
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}