-
Notifications
You must be signed in to change notification settings - Fork 1
/
ModTestGeom.bas
120 lines (87 loc) · 3.37 KB
/
ModTestGeom.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
Attribute VB_Name = "ModTestGeom"
'Source: https://github.com/krijnsent/geo_vba
Sub RunTests()
'Basic geom test
Dim g As New geom
Debug.Print "g.C_RADIUS_EARTH_KM", g.C_RADIUS_EARTH_KM
Debug.Print "g.Deg2Rad(16)", g.Deg2Rad(16)
Debug.Print "g.ArcSin(0.5)", g.ArcSin(0.5)
'Test simple coordinates
Dim CoordSW As New latLng
CoordSW.lat = 52.067267
CoordSW.lon = 5.1114603
Dim CoordNE As New latLng
CoordNE.lat = 52.074799
CoordNE.lon = 5.1285214
Debug.Print "CoordSW.toString", CoordSW.toString
Debug.Print "CoordNE.toString", CoordNE.toString
Debug.Print "CoordSW.distanceTo(CoordNE)", CoordSW.distanceTo(CoordNE)
Dim CoordTest As New latLng
CoordTest.lat = 52
CoordTest.lon = 5
Debug.Print "CoordTest.toTile 10", CoordTest.toTile(10).toString
Debug.Print "CoordTest.toTile 15", CoordTest.toTile(15).toString
'Test Box/Rectangle/Bounds
Dim TotBox As latLngBounds
Set TotBox = New latLngBounds
TotBox.latLngBounds CoordSW, CoordNE
Debug.Print "TotBox.getCenter.toString", TotBox.getCenter.toString
Debug.Print "TotBox.getNorth", TotBox.getNorth
Debug.Print "TotBox.toString", TotBox.toString
Debug.Print "TotBox.autoZoomLevel(200, 200)", TotBox.autoZoomLevel(200, 200)
Debug.Print "TotBox.autoZoomLevel(500, 500)", TotBox.autoZoomLevel(500, 500)
'One line box
Dim TotBox2 As latLngBounds
Set TotBox2 = New latLngBounds
TotBox2.setBounds Array(Array(51, 5), Array(51.2, 5.1))
Debug.Print "TotBox2.toString", TotBox2.toString
'https://www.openstreetmap.org/#map=16/51.9176/5.8190
'https://tile.openstreetmap.org/16/33830/21672.png
Dim DummyTile As New tile
DummyTile.x = 33830
DummyTile.y = 21672
DummyTile.z = 16
Debug.Print "DummyTile.toString", DummyTile.toString
Set DummyTileLatLng = DummyTile.toLatLng
Debug.Print "DummyTileLatLng.toString", DummyTileLatLng.toString
'Example from https://www.netzwolf.info/osm/tilebrowser.html?tx=34027&ty=21931&tz=16#tile
Dim DummyTile2 As New tile
DummyTile2.x = 34027
DummyTile2.y = 21931
DummyTile2.z = 16
Set DummyTileLatLngBounds = DummyTile2.toLatLngBounds
Debug.Print "DummyTileLatLngBounds.toString", DummyTileLatLngBounds.toString
Debug.Print "DummyTileLatLngBounds.getSurface", DummyTileLatLngBounds.getSurface
Dim DummyTile3 As tile
Set DummyTile3 = New tile
DummyTile3.fromString "16/21931/34027"
Debug.Print "DummyTile3.x", DummyTile3.x
Debug.Print "DummyTile3.y", DummyTile3.y
Debug.Print "DummyTile3.z", DummyTile3.z
Debug.Print "DummyTile3.toString", DummyTile3.toString
'https://stackoverflow.com/questions/28476117/easy-openstreetmap-tile-displaying-for-python
Dim TotBox4 As latLngBounds
Set TotBox4 = New latLngBounds
TotBox4.setBounds Array(Array(38.5, -77.04), Array(38.52, -76.99))
Debug.Print "TotBox4.toString", TotBox4.toString
TileNrsBox = TotBox4.toTiles(13)
For t = LBound(TileNrsBox) To UBound(TileNrsBox)
Debug.Print "TotBox4 " & t, TileNrsBox(t)
Next t
End Sub
Sub TestIMG()
MyDir = "C:\Users\Castoro\Pictures\desktopbackground\"
MyFiles = Array("", "P1060345.GIF", "P1060345.jpg", "20180512_112401.jpg", "20190829_112142.jpg")
For Each MyFile In MyFiles
Res = geo_img_data(MyDir & MyFile)
For i = LBound(Res, 2) To UBound(Res, 2)
Debug.Print MyFile, i, Res(0, i)
Next i
Next MyFile
For Each MyFile In MyFiles
Res = geo_img_data(MyDir & MyFile, "DateTime,EquipMake,EquipModel,ExifPixXDim,ExifPixYDim")
For i = LBound(Res, 2) To UBound(Res, 2)
Debug.Print MyFile, i, Res(0, i)
Next i
Next MyFile
End Sub