Category: Geolocation
[Google Maps Geocoding] ลอง Parse Json ด้วย Groovy + Java (Netbeans)
โปรเจ็คตลกๆมาอีกแล้ว เพราะโปรเจ็คนี้ผมใช้ Json Lib + Groovy + Java แต่ผมใช้ Groovy ดึง json (URL.text) แล้วใช้ Java เป็นตัวแกะ jsonObject เป็น jsonArray หลังจากนั้นเอาข้อมูลโยนกลับไปให้ Groovy ถอดเอาเฉพาะส่วนที่ต้องการออกมา (ในที่นี้คือ coordinates — latitude ,longitude นั่นแหละ) ดูวุ่นวายมาก ทั้งๆที่ เขียน Groovy อย่างเดียวก็ได้ เพราะ Json Lib ก็ลองรับ groovy หรือจะเขียน Java เพียวๆ เลยก็ได้ เรื่องของเรื่องคืออยากเขียน Java ร่วมกับ Groovy อีกครั้ง เพราะไม่ค่อยถูกกับ Java จริงๆ มันดูเวื่นเว้อ มันเขียนเวิ่นเว้อด้วย ยาวๆ งงๆ (อาจเป็นเพราะไม่ได้ศึกษาอย่างลึกซึ้ง) groovy [...]
Reverse Geocoding (Address Lookup) ผ่าน http
ลองเล่น Reverse Geocoding ของ google map api ซักกะหน่อย Reverse Geocoding คือการ เปลี่ยนชื่อสถานที่เป็นพิกัด (latitude , longitude) นั่นเอง (ความจริงมันได้ข้อมูลอื่นๆมาด้วยอีกเยอะ) วิธีทำก็ไปอ่านดูได้ที่ Reverse Geocoding (Address Lookup) หรือจะลองทำเลย ก็แค่ Request ไปที่ http://maps.google.co.th/maps/geo?q=Thammasat&output=json&sensor=falsegl=th ก็จะได้ข้อมูลมาประมาณนี้ { "name": "Thammasat Rangsit", "Status": { "code": 200, "request": "geocode" }, "Placemark": [ { "id": "p1", "address": "Thammasat Rangsit Sport Center, Khlong Nueng, Khlong Luang, Pathum [...]
เทคโนโลยีด้านการระบุตำแหน่งของผู้ส่งข้อมูล (ใช้ Geolocation API )
ขอ blog จากเอกสารบางส่วนที่ส่ง NSC ไปหน่อย เผื่อมีประโยชน์กับท่านอื่นด้วย ว่าด้วยเรื่องของการดึงข้อมูลพิกัดผ่านทาง Browser (ดึงพิกัดออกมาจากมือถือนั่นแล) การดึงพิกัดจากมือถือ ทำได้โยการใช้ Geolocation API ซึ่งส่วนสำคัญที่ใช้ในโครงงานนี้คือ Coordinates interface ซึ่งมีรายละเอียดดังนี้ interface Coordinates { readonly attribute double latitude; readonly attribute double longitude; readonly attribute double? altitude; readonly attribute double accuracy; readonly attribute double? altitudeAccuracy; readonly attribute double? heading; readonly attribute double? speed; }; จาก http://dev.w3.org/geo/api/spec-source.html แอตทริบิวต์ latitude [...]


![[Google Maps Geocoding] ลอง Parse Json ด้วย Groovy + Java (Netbeans)](http://www.together.in.th/wp-content/uploads/2010/01/Picture-5-150x150.png)