<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Computerlogy - Web Application Development &#187; ข้อแตกต่าง</title>
	<atom:link href="http://www.computerlogy.com/tag/%e0%b8%82%e0%b9%89%e0%b8%ad%e0%b9%81%e0%b8%95%e0%b8%81%e0%b8%95%e0%b9%88%e0%b8%b2%e0%b8%87/feed" rel="self" type="application/rss+xml" />
	<link>http://www.computerlogy.com</link>
	<description>Technology Matters</description>
	<lastBuildDate>Tue, 26 Jul 2011 10:48:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>ข้อแตกต่างระหว่าง Google Maps API V2 และ V3 (พื้นฐาน)</title>
		<link>http://www.computerlogy.com/%e0%b8%82%e0%b9%89%e0%b8%ad%e0%b9%81%e0%b8%95%e0%b8%81%e0%b8%95%e0%b9%88%e0%b8%b2%e0%b8%87%e0%b8%a3%e0%b8%b0%e0%b8%ab%e0%b8%a7%e0%b9%88%e0%b8%b2%e0%b8%87-google-maps-api-v2-v3</link>
		<comments>http://www.computerlogy.com/%e0%b8%82%e0%b9%89%e0%b8%ad%e0%b9%81%e0%b8%95%e0%b8%81%e0%b8%95%e0%b9%88%e0%b8%b2%e0%b8%87%e0%b8%a3%e0%b8%b0%e0%b8%ab%e0%b8%a7%e0%b9%88%e0%b8%b2%e0%b8%87-google-maps-api-v2-v3#comments</comments>
		<pubDate>Mon, 22 Mar 2010 09:44:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology Blog]]></category>
		<category><![CDATA[compare]]></category>
		<category><![CDATA[gmap2]]></category>
		<category><![CDATA[gmap3]]></category>
		<category><![CDATA[google maps api]]></category>
		<category><![CDATA[ข้อแตกต่าง]]></category>

		<guid isPermaLink="false">http://www.computerlogy.com/?p=177</guid>
		<description><![CDATA[ปัจจุบันนี้ Google ได้เปิดบริการเรียกการเชื่อมต่อกับ Google Maps ถึง 2 เวอร์ชั่นคือ Google Maps API V2 และ V3 (หรือ GMAP2 และ GMAP3 นั่นเอง) หลายคนอาจจะงงว่า เอ๊ แล้วเราจะเลือกใช้เวอร์ชั่นไหนดีล่ะ สำหรับ Google Maps API V2 (GMAP2) เปิดตัวครั้งแรกตั้งแต่เดือนเมษายน ปี 2006 เป็นเวอร์ชั่นที่สเถียรและใช้งานกันอย่างแพร่หลายที่สุดในปัจจุบัน เรียกว่าเกือบทุกๆ เว็บที่พัฒนาเชื่อมต่อกับ Google maps (Map Mashup) ทั้งหลายก็ใช้ GMAP2 กันเกือบทั้งหมด ส่วน Google Maps API V3 (GMAP3) ที่พึ่งเปิดตัวไปช่วงกลางปี 2009 ที่ผ่านมา ณ.วันนี้ (22/03/2010) GMAP3 ยังถือว่าไม่ใช่เวอร์ชั่นมาตราฐานที่ใช้พัฒนากันทั่วไป เนื่องจากยังอยู่ใน [...]]]></description>
			<content:encoded><![CDATA[<p>ปัจจุบันนี้ Google ได้เปิดบริการเรียกการเชื่อมต่อกับ Google Maps ถึง 2 เวอร์ชั่นคือ Google Maps API V2 และ V3 (หรือ GMAP2 และ GMAP3 นั่นเอง) หลายคนอาจจะงงว่า เอ๊ แล้วเราจะเลือกใช้เวอร์ชั่นไหนดีล่ะ</p>
<p>สำหรับ <strong><span style="color: #800000;">Google Maps API V2 (GMAP2) </span></strong>เปิดตัวครั้งแรกตั้งแต่เดือนเมษายน ปี 2006 เป็นเวอร์ชั่นที่สเถียรและใช้งานกันอย่างแพร่หลายที่สุดในปัจจุบัน เรียกว่าเกือบทุกๆ เว็บที่พัฒนาเชื่อมต่อกับ Google maps (Map Mashup) ทั้งหลายก็ใช้ GMAP2 กันเกือบทั้งหมด</p>
<p>ส่วน <strong><span style="color: #0000ff;">Google Maps API V3 (GMAP3)</span></strong> ที่พึ่งเปิดตัวไปช่วงกลางปี 2009 ที่ผ่านมา ณ.วันนี้ (22/03/2010) GMAP3 ยังถือว่าไม่ใช่เวอร์ชั่นมาตราฐานที่ใช้พัฒนากันทั่วไป เนื่องจากยังอยู่ใน Labs ยังไม่มี Official Release กันอย่างจริงๆ จังๆ แต่เนื่องจากการที่มีคุณสมบัติการเรียกใช้ที่ dynamic มากกว่า จึงทำให้นักพัฒนาหลายๆ กลุ่มเริ่มขยับขยายมาใช้ GMAP3 กันบ้างแล้ว และจากที่ได้พัฒนาบน GMAP3 มาซักพักก็พบว่า การใช้งานโดยทั่วไปก็สเถียรเกือบหมดแล้ว ติดตรงที่พบบักเรื่องการหาระยะทางอีกนิดหน่อย และหาเอกสารอ่านได้ยากกว่า GMAP2 (อาจจะเพราะว่า พึ่งออกนั่นเอง)</p>
<a title="GMAP3" rel="lightbox[pics177]" href="http://www.computerlogy.com/wp-content/uploads/2010/03/GMAP3.png"><img class="attachment wp-att-182 centered" src="http://www.computerlogy.com/wp-content/uploads/2010/03/GMAP3.png" alt="GMAP3" width="518" height="394"></a>
<p style="text-align: center;">(ภาพประกอบ Theme ที่อยู่ใน Lab ของ Computerlogy)</p>
<p>เอาล่ะ เรามาดูข้อแตกต่างสำหรับการเรียกใช้ GMAP2 VS GMAP3 สำหรับการเรียกใช้แบบสุดพื้นฐาน หรือ Hello World กันดีกว่า</p>
<strong>เริ่มจากการเรียก Java script ในส่วนบน</strong><br>
<strong><span style="color: #800000;"> GMAP2</span></strong>
<p>[code lang="html"]<br>
&lt;script src=&quot;http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=abcdefg&amp;sensor=true_or_false&quot;<br>
            type=&quot;text/javascript&quot;&gt;<br>
&lt;/script&gt;<br>
[/code]</p>
<strong><span style="color: #0000ff;"> GMAP3</span></strong>
<p>[html]<br>
&lt;script type=&quot;text/javascript&quot; src=&quot;http://maps.google.com/maps/api/js?sensor=set_to_true_or_false&quot;&gt;<br>
&lt;/script&gt;<br>
[/html]</p>
<p>การจะเรียกใช้ GMAP2 จะต้องอ้างอิงถึง API Key ในทุกๆครั้ง แต่สำหรับ GMAP3 ไม่ต้องแล้ว</p>
<strong>ฟังก์ชั่นการเรียกค่าเริ่มต้น (Initialize)</strong><br>
<strong><span style="color: #800000;"> GMAP2</span></strong>
<p>[html]<br>
    &lt;script type=&quot;text/javascript&quot;&gt;<br>
    function initialize() {<br>
      if (GBrowserIsCompatible()) {<br>
        var map = new GMap2(document.getElementById(&quot;map_canvas&quot;));<br>
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);<br>
        map.setUIToDefault();<br>
      }<br>
    }<br>
    &lt;/script&gt;<br>
[/html]</p>
<strong><span style="color: #0000ff;">GMAP3</span></strong>
<p>[html]<br>
&lt;script type=&quot;text/javascript&quot;&gt;<br>
  function initialize() {<br>
    var latlng = new google.maps.LatLng(-34.397, 150.644);<br>
    var myOptions = {<br>
      zoom: 8,<br>
      center: latlng,<br>
      mapTypeId: google.maps.MapTypeId.ROADMAP<br>
    };<br>
    var map = new google.maps.Map(document.getElementById(&quot;map_canvas&quot;), myOptions);<br>
  }<br>
&lt;/script&gt;<br>
[/html]</p>
<p>สังเกตุว่าการเรียกค่าต่างๆ แยกออกเป็นส่วนๆ และมองเป็น Object มากขึ้น</p>
<strong>สุดท้ายจบที่ส่วน Body ที่เรียกใช้งาน function ข้างบน</strong><br>
<strong><span style="color: #800000;"> GMAP2</span></strong>
<p>[html]<br>
  &lt;body onload=&quot;initialize()&quot; onunload=&quot;GUnload()&quot;&gt;<br>
    &lt;div id=&quot;map_canvas&quot; style=&quot;width: 500px; height: 300px&quot;&gt;&lt;/div&gt;<br>
  &lt;/body&gt;<br>
[/html]</p>
<strong><span style="color: #0000ff;">GMAP3</span></strong>
<p>[html]<br>
&lt;body onload=&quot;initialize()&quot;&gt;<br>
  &lt;div id=&quot;map_canvas&quot; style=&quot;width:100%; height:100%&quot;&gt;&lt;/div&gt;<br>
&lt;/body&gt;<br>
[/html]</p>
<p>แทบจะไม่มีอะไรแตกต่างในส่วนนี้</p>
<p>ซึ่งโดยภาพรวมการเรียกใช้ในระดับสูง (Presentation layer) มีข้อแตกต่างกันที่น้อยมาก ส่วนที่จะต้องปรับปรุงแก้ไข หากเปลี่ยนจาก GMAP2 มาเป็น GMAP3 จะเป็นส่วนการเรียกใช้ฟังก์ชั่นต่างๆ ที่ API ให้มาซึ่งจะต้องไปเทียบกันพอสมควรทีเดียว ดังนั้นหากใครกำลังวางแผนจะพัฒนาระบบที่เชื่อมต่อกับ Google Maps API แนะนำว่าให้ตัดสินใจเลือกเวอร์ชั่นให้ดี เพราะคาดว่า GMAP3 ก็จะออกจาก Labs ภายในปี 2010 นี้แน่นอน และฟังก์ชั่นการใช้งานใหม่ๆ ก็ออกมาสำหรับ GMAP3 เท่านั้นซะด้วยซิ</p>
]]></content:encoded>
			<wfw:commentRss>http://www.computerlogy.com/%e0%b8%82%e0%b9%89%e0%b8%ad%e0%b9%81%e0%b8%95%e0%b8%81%e0%b8%95%e0%b9%88%e0%b8%b2%e0%b8%87%e0%b8%a3%e0%b8%b0%e0%b8%ab%e0%b8%a7%e0%b9%88%e0%b8%b2%e0%b8%87-google-maps-api-v2-v3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

