SlideShare a Scribd company logo
<!DOCTYPE html>
<html>
<head>
<title>Custom Markers</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-
scalable=no">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 16,
center: {lat: 13.277605, lng: 100.926524},
mapTypeId: 'roadmap'
});
var iconBase = 'https://maps.google.com/mapfiles/kml/shapes/';
var icons = {
coffee1: {
icon: iconBase + 'coffee.png'
},
coffee2: {
icon: iconBase + 'coffee.png'
},
coffee3: {
icon: iconBase + 'coffee.png'
},
coffee4: {
icon: iconBase + 'coffee.png'
},
coffee5: {
icon: iconBase + 'coffee.png'
},
coffee6: {
icon: iconBase + 'coffee.png'
},
coffee7: {
icon: iconBase + 'coffee.png'
},
coffee8: {
icon: iconBase + 'coffee.png'
},
coffee9: {
icon: iconBase + 'coffee.png'
},
info: {
icon: iconBase + 'coffee.png'
}
};
function addMarker(feature) {
var marker = new google.maps.Marker({
position: feature.position,
icon: icons[feature.type].icon,
map: map
});
}
var features = [
{
position: {lat:13.282858, lng:100.926069},
type: 'coffee1'
}, {
position: {lat:13.282151,lng :100.925945},
type: 'coffee2'
}, {
position: {lat:13.281829, lng:100.925052},
type: 'coffee3'
}, {
position: {lat:13.278026, lng:100.926130},
type: 'coffee4'
}, {
position: {lat:13.275910, lng:100.925444},
type: 'coffee5'
}, {
position: {lat:13.277627, lng:100.923896},
type: 'coffee6'
}, {
position: {lat:13.278627, lng:100.924916},
type: 'coffee7'
}, {
position: {lat:13.281307, lng:100.922771},
type: 'coffee8'
}, {
position: {lat:13.285014, lng:100.921904},
type: 'coffee9'
},
];
for (var i = 0, feature; feature = features[i]; i++) {
addMarker(feature);
}
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD6-Augszd-
bxFINbUabQn6nk30BkZLYWc&callback=initMap"
async defer></script>
</body>
</html>

More Related Content

Similar to โค๊ดที่ใช้ทำ Custom markers หรือการปักหมุด

Private slideshow
Private slideshowPrivate slideshow
Private slideshow
sblackman
 
#win8acad : Building a Windows 8 Metro Style UI
#win8acad : Building a Windows 8 Metro Style UI#win8acad : Building a Windows 8 Metro Style UI
#win8acad : Building a Windows 8 Metro Style UI
Frederik De Bruyne
 
HTML5 & The Open Web - at Nackademin
HTML5 & The Open Web -  at NackademinHTML5 & The Open Web -  at Nackademin
HTML5 & The Open Web - at Nackademin
Robert Nyman
 
Create a mobile web app with Sencha Touch
Create a mobile web app with Sencha TouchCreate a mobile web app with Sencha Touch
Create a mobile web app with Sencha Touch
James Pearce
 
Cloud Endpoints _Polymer_ Material design by Martin Görner
Cloud Endpoints_Polymer_Material design by Martin GörnerCloud Endpoints_Polymer_Material design by Martin Görner
Cloud Endpoints _Polymer_ Material design by Martin Görner
European Innovation Academy
 

Similar to โค๊ดที่ใช้ทำ Custom markers หรือการปักหมุด (20)

WebAPI Odata Knockout
WebAPI Odata KnockoutWebAPI Odata Knockout
WebAPI Odata Knockout
 
ESRI Dev Meetup: Building Distributed JavaScript Map Widgets
ESRI Dev Meetup: Building Distributed JavaScript Map WidgetsESRI Dev Meetup: Building Distributed JavaScript Map Widgets
ESRI Dev Meetup: Building Distributed JavaScript Map Widgets
 
Sencha Touch
Sencha TouchSencha Touch
Sencha Touch
 
Gmaps Railscamp2008
Gmaps Railscamp2008Gmaps Railscamp2008
Gmaps Railscamp2008
 
@Ionic native/google-maps
@Ionic native/google-maps@Ionic native/google-maps
@Ionic native/google-maps
 
Canvas
CanvasCanvas
Canvas
 
OL4JSF - Latinoware 2010
OL4JSF - Latinoware 2010OL4JSF - Latinoware 2010
OL4JSF - Latinoware 2010
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
 
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
 
#win8acad : Building a Windows 8 Metro Style UI
#win8acad : Building a Windows 8 Metro Style UI#win8acad : Building a Windows 8 Metro Style UI
#win8acad : Building a Windows 8 Metro Style UI
 
Svcc 2013-d3
Svcc 2013-d3Svcc 2013-d3
Svcc 2013-d3
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
 
Prototype UI Intro
Prototype UI IntroPrototype UI Intro
Prototype UI Intro
 
A mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutesA mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutes
 
HTML5 & The Open Web - at Nackademin
HTML5 & The Open Web -  at NackademinHTML5 & The Open Web -  at Nackademin
HTML5 & The Open Web - at Nackademin
 
Create a mobile web app with Sencha Touch
Create a mobile web app with Sencha TouchCreate a mobile web app with Sencha Touch
Create a mobile web app with Sencha Touch
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Prototype UI
Prototype UIPrototype UI
Prototype UI
 
Cloud Endpoints _Polymer_ Material design by Martin Görner
Cloud Endpoints_Polymer_Material design by Martin GörnerCloud Endpoints_Polymer_Material design by Martin Görner
Cloud Endpoints _Polymer_ Material design by Martin Görner
 
Mobile Application Development for the Web Developer
Mobile Application Development for the Web DeveloperMobile Application Development for the Web Developer
Mobile Application Development for the Web Developer
 

More from ranggo24

More from ranggo24 (19)

Captureหลักกกกก
CaptureหลักกกกกCaptureหลักกกกก
Captureหลักกกกก
 
Captureหลักกกกก
CaptureหลักกกกกCaptureหลักกกกก
Captureหลักกกกก
 
Captureหลักกกกก
CaptureหลักกกกกCaptureหลักกกกก
Captureหลักกกกก
 
Captureหลักกกกก
CaptureหลักกกกกCaptureหลักกกกก
Captureหลักกกกก
 
Captureหลักกกกก
CaptureหลักกกกกCaptureหลักกกกก
Captureหลักกกกก
 
CAPTURE วิชา Land Use Mapping Techniques
CAPTURE วิชา Land Use Mapping TechniquesCAPTURE วิชา Land Use Mapping Techniques
CAPTURE วิชา Land Use Mapping Techniques
 
นายธนาคม ตรสุรนรา รหัสนิสิต 58670329
นายธนาคม ตรสุรนรา  รหัสนิสิต 58670329นายธนาคม ตรสุรนรา  รหัสนิสิต 58670329
นายธนาคม ตรสุรนรา รหัสนิสิต 58670329
 
นายคริตยวงค์ อ่วมอารีย์ 58670004กลุ่ม3303
นายคริตยวงค์ อ่วมอารีย์ 58670004กลุ่ม3303นายคริตยวงค์ อ่วมอารีย์ 58670004กลุ่ม3303
นายคริตยวงค์ อ่วมอารีย์ 58670004กลุ่ม3303
 
นางสาวศศินิภา ซิ้มศิริ รหัสนิสิต 58670396
นางสาวศศินิภา ซิ้มศิริ รหัสนิสิต 58670396นางสาวศศินิภา ซิ้มศิริ รหัสนิสิต 58670396
นางสาวศศินิภา ซิ้มศิริ รหัสนิสิต 58670396
 
Amonrat 58670419 capture
Amonrat 58670419 captureAmonrat 58670419 capture
Amonrat 58670419 capture
 
58670414 อนันตาพร จำเนียรการ
58670414 อนันตาพร จำเนียรการ58670414 อนันตาพร จำเนียรการ
58670414 อนันตาพร จำเนียรการ
 
Matlab58670379
Matlab58670379Matlab58670379
Matlab58670379
 
Matlab58670329
Matlab58670329Matlab58670329
Matlab58670329
 
Matlab58670413 tone
Matlab58670413 toneMatlab58670413 tone
Matlab58670413 tone
 
Matlab puck
Matlab puckMatlab puck
Matlab puck
 
2
22
2
 
Matlab puck
Matlab puckMatlab puck
Matlab puck
 
Matlab 58670396-บรีม
Matlab 58670396-บรีมMatlab 58670396-บรีม
Matlab 58670396-บรีม
 
Matlab5867004
Matlab5867004Matlab5867004
Matlab5867004
 

Recently uploaded

Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 

Recently uploaded (20)

Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 

โค๊ดที่ใช้ทำ Custom markers หรือการปักหมุด

  • 1. <!DOCTYPE html> <html> <head> <title>Custom Markers</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, user- scalable=no"> <meta charset="utf-8"> <style> /* Always set the map height explicitly to define the size of the div * element that contains the map. */ #map { height: 100%; } /* Optional: Makes the sample page fill the window. */ html, body { height: 100%; margin: 0; padding: 0; } </style> </head> <body> <div id="map"></div> <script> var map; function initMap() { map = new google.maps.Map(document.getElementById('map'), { zoom: 16,
  • 2. center: {lat: 13.277605, lng: 100.926524}, mapTypeId: 'roadmap' }); var iconBase = 'https://maps.google.com/mapfiles/kml/shapes/'; var icons = { coffee1: { icon: iconBase + 'coffee.png' }, coffee2: { icon: iconBase + 'coffee.png' }, coffee3: { icon: iconBase + 'coffee.png' }, coffee4: { icon: iconBase + 'coffee.png' }, coffee5: { icon: iconBase + 'coffee.png' }, coffee6: { icon: iconBase + 'coffee.png' }, coffee7: { icon: iconBase + 'coffee.png' }, coffee8: { icon: iconBase + 'coffee.png' },
  • 3. coffee9: { icon: iconBase + 'coffee.png' }, info: { icon: iconBase + 'coffee.png' } }; function addMarker(feature) { var marker = new google.maps.Marker({ position: feature.position, icon: icons[feature.type].icon, map: map }); } var features = [ { position: {lat:13.282858, lng:100.926069}, type: 'coffee1' }, { position: {lat:13.282151,lng :100.925945}, type: 'coffee2' }, { position: {lat:13.281829, lng:100.925052}, type: 'coffee3' }, { position: {lat:13.278026, lng:100.926130}, type: 'coffee4' }, {
  • 4. position: {lat:13.275910, lng:100.925444}, type: 'coffee5' }, { position: {lat:13.277627, lng:100.923896}, type: 'coffee6' }, { position: {lat:13.278627, lng:100.924916}, type: 'coffee7' }, { position: {lat:13.281307, lng:100.922771}, type: 'coffee8' }, { position: {lat:13.285014, lng:100.921904}, type: 'coffee9' }, ]; for (var i = 0, feature; feature = features[i]; i++) { addMarker(feature); } } </script> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD6-Augszd- bxFINbUabQn6nk30BkZLYWc&callback=initMap" async defer></script> </body> </html>