var pointA = new BMap.Point(121.436043,29.294384);
var pointB = new BMap.Point(116.450111,39.927669);
以上量点坐标,如何计算直线距离?精确到米
请帮助!!
以下是返回地址名称,就是按这样的格式写:如何写?
Dim e As RequestEventArgs = args(0) '网页函数开始 报位置的中文名称
Dim stt As String = e.PlainText
Dim nms() As String = stt.Split("|")
Dim jingdu As Double = CDbl(nms(0)) '经度
Dim weidu As Double = CDbl(nms(1)) '纬度
Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://api.map.baidu.com/geocoder/v2/?ak=DD93be593f80a0ad6adc764c39625bd1&output=json&location=" & weidu & "," & jingdu)
Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
Dim stm As System.IO.Stream = rsps.GetResponseStream()
Dim reader As New System.IO.StreamReader(stm)
Dim json As String = reader.ReadToEnd
Dim ScriptControl As Object, data As Object, JscriptCode As String
JscriptCode = "function toObject(json) {eval(""var o=""+json);return o;}"
ScriptControl = CreateObject("MSScriptControl.ScriptControl")
With ScriptControl
.Language = "Javascript"
.Timeout = -1
.AddCode(JscriptCode)
data = .Run("toObject", json)
End With
e.WriteString(data.result.formatted_address)
[此贴子已经被作者于2018/11/14 8:39:43编辑过]