|
|
|
สอบถามการใส่รูปภาพ marker google map อยากจะ custom marker ครับ |
|
|
|
|
|
|
|
Code (JavaScript)
//Base Color
var base_color = '#9dc500';
//Google Maps Coordinates
var google_maps_latitude = 16.8234;
var google_maps_longitude = 100.262;
function startGmap() {
var myOptions = {
zoom: 16,
center: new google.maps.LatLng(google_maps_latitude, google_maps_longitude),
navigationControlOptions: {style: google.maps.NavigationControlStyle.ZOOM_PAN, position: google.maps.ControlPosition.RIGHT_TOP},
streetViewControl: false,
scrollwheel: false,
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE,
position: google.maps.ControlPosition.RIGHT_TOP
},
mapTypeControl: false,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,
position: google.maps.ControlPosition.TOP_RIGHT,
mapTypeIds: ["ptMap"]
}
};
map = new google.maps.Map(document.getElementById('contact_map'), myOptions);
var styleCP = [
{ featureType: "administrative", elementType: "all", stylers: [ { visibility: "off" } ] },
{ featureType: 'landscape', elementType: 'all', stylers: [ { hue: '#3bffoo' }, { saturation:20 }, { lightness:50 }, { visibility: 'on' } ] },
{ featureType: "poi", elementType: "all", stylers: [ { visibility: "off" } ] },
{ featureType: "road", elementType: "all", stylers: [ { visibility: "on" }, { lightness:0 } ] },
{ featureType: "transit", elementType: "all", stylers: [ { visibility: "off" } ] },
{ featureType: "water", elementType: "all", stylers: [ { saturation: 20 }, { lightness: 50 } ] },
{ featureType: "all", elementType: "all", stylers: [ { saturation: 20 }, { lightness: 50 } ] }
];
var styledMapOptions = {name: "Map"};
var ptMapType = new google.maps.StyledMapType(styleCP, styledMapOptions);
map.mapTypes.set("ptMap", ptMapType);
map.setMapTypeId("ptMap");
/**/
var circle = {
path: google.maps.SymbolPath.CIRCLE,
fillOpacity: 0.75,
fillColor: base_color,
strokeOpacity: 1.0,
strokeColor: base_color,
strokeWeight: 1.0,
scale: 20
};
var point = new google.maps.LatLng(google_maps_latitude, google_maps_longitude);
var marker = new google.maps.Marker({
position: point,
map: map,
zIndex: 99999,
optimized: false,
icon: circle
});
}
จาก code ส่วนนี้ ผมจะสามารถ custom marker โดยใช้ รูปภาพได้อย่างไรครับ แนะนำหน่อย code maker จะอย่าล่างสุดครับ
Tag : PHP, JavaScript, Ajax, JAVA
|
|
|
|
|
|
Date :
2012-09-17 14:54:14 |
By :
feedblackho |
View :
1490 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var image = 'beachflag.png';
var beachMarker = new google.maps.Marker({
position: point,
map: map,
icon: image
});
เอาอันเก่าออก
|
|
|
|
|
Date :
2012-09-18 17:43:28 |
By :
numton |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองแล้วภาพไม่ขึ้นครับ ไม่ทราบว่าต้องอ้างอิง path ไฟล์รูปภาพด้วยหรือป่าว พอดีไฟล์ .js นี้ผมเอาไว้ใน Folder js ครับ ส่วนรูปภาพ marker ก็
อยู่ในนี้ด้วย ไม่ทราบว่าถูกต้องหรือป่าว
|
|
|
|
|
Date :
2012-09-23 14:54:32 |
By :
feedblackho |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|