I am trying to plot multiple locations on a Google map, but every time after a certain amount I get a “NilObjectException” error. After I press the start button again, I did not quit the run, but it stopped, the application resumes till a certain amount of additions later and then it stops again with this error. This goes on till the whole list is processed and then it does it again with the next run.
First I thought that the coordinates were not existing or of a wrong value, so every time the run stopped with the “NilObjectException” error, I copied the coordinates from the debug window and entered them in the online Google maps where they were perfectly shown (?).
This is the input I use:
22092015/00:42:50,2.7 , PUERTO RICO REGION,18.71,-65.74
22092015/00:34:12,2.3 , NEVADA,41.87,-119.64
22092015/00:26:03,2.8 , EASTERN TURKEY,39.41,40.49
22092015/00:17:30,4.2 , OFFSHORE GUATEMALA,13.84,-91.51
22092015/00:12:28,3.4 , OFF COAST OF COQUIMBO - CHILE,-31.76,-72.70
and this is the code which read it from a file and should plot it in the map (I use zoom-3 to show the world map):
Dim f As FolderItem
Dim textInput As TextInputStream
Dim RLine, cell(4) as string
f = GetFolderItem(“C:\Users\Rob\Desktop\ewDTS\var\data\db\db.dat”)
If f <> Nil And f.Exists Then
textInput = TextInputStream.Open(f)
textInput.Encoding = Encodings.MacRoman
while not textinput.EOF
RLine = textinput.ReadLine
cell = split(Rline,",")
Try
CurrentLocation = New WebMapLocation(cell(3)+","+cell(4))
CurrentLocation.Visible = True
MapLocation.AddLocation(CurrentLocation) //<<<<<------ this is the line where the NilObjectException occurs
Catch err As NilObjectException
End Try
wend
end if
Because I am still in design/code/testphase I use flat sequential files as input. Once when all is working file it will be stored in a SQLite db.
Does somebody have a clue what and why it is happening?
Rob