 |
|
ขอ Code ดึงค่า ระยะทางของ Google Map เป็นกี่กิโลเมตรกี่ชั่วโมง (VB) |
|
 |
|
|
 |
 |
|
สงสัยทำได้ไปแล้ว ถ้าทำได้ เอาโค้ดมาแปะไว้หน่อยเน่อ เผื่อคนรุ่นถัดไปจะได้ใช้กันด้วยนะครับ
|
 |
 |
 |
 |
Date :
2012-06-06 11:02:38 |
By :
deawx |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยังทำไม่ได้ครับพี่ กำลังหาข้อมูลอยู่เรื่อยๆ
ถ้าได้แล้วจะ เอาโค้ดมาแปะ ให้ครับ
|
 |
 |
 |
 |
Date :
2012-06-08 12:23:41 |
By :
Loki723 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: :::
'::: This routine calculates the distance between two points (given the :::
'::: latitude/longitude of those points). It is being used to calculate :::
'::: the distance between two ZIP Codes or Postal Codes using our :::
'::: ZIPCodeWorld(TM) and PostalCodeWorld(TM) products. :::
'::: :::
'::: Definitions: :::
'::: South latitudes are negative, east longitudes are positive :::
'::: :::
'::: Passed to function: :::
'::: lat1, lon1 = Latitude and Longitude of point 1 (in decimal degrees) :::
'::: lat2, lon2 = Latitude and Longitude of point 2 (in decimal degrees) :::
'::: unit = the unit you desire for results :::
'::: where: 'M' is statute miles :::
'::: 'K' is kilometers (default) :::
'::: 'N' is nautical miles :::
'::: :::
'::: United States ZIP Code/ Canadian Postal Code databases with latitude :::
'::: & longitude are available at http://www.zipcodeworld.com :::
'::: :::
'::: For enquiries, please contact [email protected] :::
'::: :::
'::: Official Web site: http://www.zipcodeworld.com :::
'::: :::
'::: Hexa Software Development Center © All Rights Reserved 2010 :::
'::: :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
const pi = 3.14159265358979323846
Function distance(lat1, lon1, lat2, lon2, unit)
Dim theta, dist
theta = lon1 - lon2
dist = sin(deg2rad(lat1)) * sin(deg2rad(lat2)) + cos(deg2rad(lat1)) * cos(deg2rad(lat2)) * cos(deg2rad(theta))
response.write "dist = " & dist & "<br>"
dist = acos(dist)
dist = rad2deg(dist)
response.write "dist = " & dist & "<br>"
distance = dist * 60 * 1.1515
Select Case ucase(unit)
Case "K"
distance = distance * 1.609344
Case "N"
distance = distance * 0.8684
End Select
End Function
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: This function get the arccos function using arctan function :::
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Function acos(rad)
If Abs(rad) <> 1 Then
acos = pi/2 - Atn(rad / Sqr(1 - rad * rad))
ElseIf rad = -1 Then
acos = pi
End If
End function
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: This function converts decimal degrees to radians :::
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Function deg2rad(Deg)
deg2rad = cdbl(Deg * pi / 180)
End Function
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: This function converts radians to decimal degrees :::
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Function rad2deg(Rad)
rad2deg = cdbl(Rad * 180 / pi)
End Function
msgbox(distance(32.9697, -96.80322, 29.46786, -98.53506, "M") & " Miles<br>")
msgbox(distance(32.9697, -96.80322, 29.46786, -98.53506, "K") & " Kilometers<br>")
msgbox(distance(32.9697, -96.80322, 29.46786, -98.53506, "N") & " Nautical Miles<br>")
http://www.zipcodeworld.com/samples/distance.vbs.txt
ตามลิ้งค่ะ สำหรับหาระยะห่าง
|
ประวัติการแก้ไข 2012-06-08 13:23:51 2012-06-08 13:30:24
 |
 |
 |
 |
Date :
2012-06-08 13:23:23 |
By :
bangbang111 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แหละ ครับพี่ๆ
Code (VB.NET)
Dim URL As String
URL = "http://maps.googleapis.com/maps/api/directions/xml?origin=London&destination=Liverpool&sensor=false"
Dim doc As New XmlDocument()
Dim nodes As XmlNodeList
doc.Load(URL)
nodes = doc.SelectNodes("/DirectionsResponse/route/leg/distance")
Dim node As XmlNode
For Each node In nodes
TextBox1.Text = node.SelectSingleNode("text").InnerText
Next
|
 |
 |
 |
 |
Date :
2012-06-09 16:51:40 |
By :
Loki723 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Input จุด A และ จุด B ลง Textbox
แล้วไปแสดงาระยะทาง
ระหว่างจุด A ถึง B ว่ากี่กิโลเมตร กี่นาที
แล้วนำข้อมูลไปแสดงในอีก Textbox ผมหามานานยังไม่ได้เลย กรุณาช่วย แนะหน่อยครับ ตอนนี้ยังได้แค่ หาสถานที่ ครับ รบกวนด้วยนะครับ
|
 |
 |
 |
 |
Date :
2012-07-13 12:47:04 |
By :
sakdinath |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อยากได้แบบนี้เหมือนกันหามานาน ขอตัวอย่างการสร้าง อย่าง ระเอียดด้วยนะครับ หากท่านใดสมามรถสร้างได้คือผม ไม่ค่อยมีพืนฐาน ครับ
|
 |
 |
 |
 |
Date :
2012-07-13 13:22:56 |
By :
kenggoogle |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอโค้ดC#การมาร์กจุดหลายๆจุดบนแผนที่ แล้วรับค่าพิกัดมาเก็บไว้หน่อยค่ะ
|
 |
 |
 |
 |
Date :
2012-08-10 03:03:36 |
By :
joyph |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (VB.NET)
Try
Dim weight As Integer
Dim URL As String
Dim StrBegin As String 'แทนจุด A
Dim StrEnd As String 'แทนจุด B
Dim Distance() As String
Dim FullDistance As String
URL = "http://maps.googleapis.com/maps/api/directions/xml?origin=" & StrBegin & "&destination=" & StrEnd & "&sensor=false"
Dim doc As New XmlDocument()
Dim nodes As XmlNodeList
doc.Load(URL)
nodes = doc.SelectNodes("/DirectionsResponse/route/leg/distance")
Dim node As XmlNode
For Each node In nodes
FullDistance = node.SelectSingleNode("text").InnerText
Distance = Split(FullDistance) 'แยกคำว่ากิโลเมตร ออก
weight = Distance(0) 'เลือกเอาเฉพาะระยะทาง
Next
MessageBox.Show(weight)
Catch ex As Exception
MessageBox.Show("ไม่มีการเชื่อมต่อจากเครือข่าย", "ผิดพลาด", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
ได้ ไม่ได้ตรงไหนบอกนะครับแก้ไข ให้
|
ประวัติการแก้ไข 2012-08-24 21:35:51
 |
 |
 |
 |
Date :
2012-08-24 21:34:35 |
By :
Loki723 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สอบถามข้อมูลได้ที่ : https://www.facebook.com/tanin.udomsri
|
 |
 |
 |
 |
Date :
2014-10-10 14:02:52 |
By :
Loki723 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|