|
@@ -25,25 +25,33 @@ Module YandexLocation
|
25
|
25
|
End Function
|
26
|
26
|
Private Sub JSONDECODE()
|
27
|
27
|
Dim MyJson As JObject = Json.JsonConvert.DeserializeObject(respone)
|
|
28
|
+ '[JSON].response.GeoObjectCollection.metaDataProperty.GeocoderResponseMetaData.results
|
28
|
29
|
'[JSON].response.GeoObjectCollection.featureMember.[0].GeoObject.Point.pos
|
29
|
|
- Coordinates = MyJson("response")("GeoObjectCollection")("featureMember")(0)("GeoObject")("Point")("pos")
|
|
30
|
+ If MyJson("response")("GeoObjectCollection")("metaDataProperty")("GeocoderResponseMetaData")("results").ToString = "0" Then
|
|
31
|
+ Coordinates = Nothing
|
|
32
|
+ Else
|
|
33
|
+ Coordinates = MyJson("response")("GeoObjectCollection")("featureMember")(0)("GeoObject")("Point")("pos")
|
|
34
|
+ End If
|
30
|
35
|
End Sub
|
31
|
36
|
|
32
|
37
|
Public Function lat()
|
33
|
|
- Dim cord As Array = Split(Coordinates, " ")
|
34
|
|
- Dim l1 As Double = Convert.ToDouble(cord(1))
|
35
|
|
- Return l1
|
|
38
|
+ If Coordinates IsNot Nothing Then
|
|
39
|
+ Dim cord As Array = Split(Coordinates, " ")
|
|
40
|
+ Dim l1 As String = (cord(1))
|
|
41
|
+ Return l1
|
|
42
|
+ Else
|
|
43
|
+ Return ""
|
|
44
|
+ End If
|
36
|
45
|
End Function
|
37
|
46
|
|
38
|
47
|
Public Function lng()
|
39
|
|
- Dim cord As Array = Split(Coordinates, " ")
|
40
|
|
- Dim l1 As Double = Convert.ToDouble(cord(0))
|
41
|
|
- Return l1
|
|
48
|
+ If Coordinates IsNot Nothing Then
|
|
49
|
+ Dim cord As Array = Split(Coordinates, " ")
|
|
50
|
+ Dim l1 As String = (cord(0))
|
|
51
|
+ Return l1
|
|
52
|
+ Else
|
|
53
|
+ Return ""
|
|
54
|
+ End If
|
42
|
55
|
End Function
|
43
|
56
|
End Class
|
44
|
|
-
|
45
|
|
-
|
46
|
|
- Sub Main()
|
47
|
|
- Dim loc As YandexLocatin = New YandexLocatin("4-ый Загородный переулок, дом 20, Минск, Беларусь")
|
48
|
|
- End Sub
|
49
|
57
|
End Module
|