Page 2 of 3

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Posted: Mon Aug 09, 2021 6:19 pm
by Fernando Perez
Thanks Marcello. I'm happy for Andy. This is what my screen looks like right now with his program:
image.png
Well, it looks better, the photo is not very good.

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Posted: Mon Aug 09, 2021 11:02 pm
by cicciocb
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Aug 09, 2021 6:19 pm Thanks Marcello. I'm happy for Andy. This is what my screen looks like right now with his program:
image.png
Well, it looks better, the photo is not very good.
No problem Armando :D

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Posted: Mon Aug 09, 2021 11:17 pm
by Electroguard
I'm afraid the Strait of Gibraltar is being shown on the wrong continent.

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Posted: Tue Aug 10, 2021 7:59 am
by Fernando Perez
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Sun Aug 08, 2021 1:43 pm With more data from earthquakes, I see that my latitude-to-point conversion calculation "y" on the graph is not working correctly.
I have also tried without success with:

Code: [Local Link Removed for Guests]

' Convert longitude and latitude of event to screen co-ordinates.
    x = cInt(convert.map(lon, -180, 180, 0, 480))
    y = cInt(convert.map(lat, -90, 90, 0, 320))
    y = (320 - y) + 52
However, the conversion for the x-axis does seem correct.
Do any of you know the subject of geographic coordinates?
You can help me?
Right, Robin.
Currently the code I posted seems to correctly calculate the x-axis (longitude) value but fails on the y-axis (latitude).
I have to enter a conversion factor as latitude is not linear.
While waiting for Andy to dismiss his guests :lol:, I have obtained a csv file to treat in Excel and calculate the formula to be applied:

Code: [Local Link Removed for Guests]

file$ = "/latitud.txt"
for lat = -90 to 90 step 0.5
  y = cInt(convert.map(lat, -90, 90, 0, 320))
  line$ = str$(lat) + ";" + str$(y) + chr$(10)
  file.append file$, line$
  wlog line$
next lat  
But I am stopped.
If something occurs to you, I'll listen to you.

https://www.myrapidq.it/public/latitud.xlsx
https://www.myrapidq.it/public/Nicaragua.jpeg
https://www.myrapidq.it/public/Indonesia.jpeg

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Posted: Tue Aug 10, 2021 8:22 am
by Fernando Perez
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Aug 09, 2021 11:02 pm
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Aug 09, 2021 6:19 pm Thanks Marcello. I'm happy for Andy. This is what my screen looks like right now with his program:
image.png
Well, it looks better, the photo is not very good.
No problem Armando :D
Francesco, this is my last neuron taking a vacation. :o
image.png

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Posted: Tue Aug 10, 2021 8:37 am
by Electroguard
Yeah 'Fernando, I'm sure Andy will sort you out as soon as he is able.

I only pointed out Strait of Gibraltar error in case it hadn't already been noticed, whereas it was immediately apparent to me cos I used to see Gibraltar every day when I lived in Estepona Spain.

I hope your neuron has not gone to Gib for holiday cos the border queues were horrendous so you might not get it back for a while!

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Posted: Tue Aug 10, 2021 12:13 pm
by cicciocb
The map should be calibrated.

Are you able to superpose some kind of latitude reference on the map ?

Taking into account the latitude reference, a calibration map could be created with linear interpolation or with a polynomial one

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Posted: Tue Aug 10, 2021 12:37 pm
by cicciocb
This should be the latitude grid.
As you can see it is not linear
map2.jpg
Using GIMP I extracted all the Y pixel position for each latitude :

Code: [Local Link Removed for Guests]

Degrees	|	Y (pixel)
90		|		0
75		|		68
60		|		122
45		|		155
30		|		181
15		|		202
0		|		223
-15		|		243
-30		|		265
-45		|		290
-60		|		319

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Posted: Tue Aug 10, 2021 1:44 pm
by Fernando Perez
If I apply:

Code: [Local Link Removed for Guests]

   y = cInt (convert.map (lat, -60, 90, 319, 0))
I get this:
image.png
Tonight I will have time to try to get the correlation.
Thanks, as always.
(We're not leaving Andy anything to do 8-) )

Re: Global Earthquake Display on ILI9341 TFT. - From old forum.

Posted: Tue Aug 10, 2021 2:01 pm
by cicciocb
I used an online service to determine the polynomial conversion parameters. https://planetcalc.com/
The conversion should be :

Code: [Local Link Removed for Guests]


Y = 2.78e-10 * lat^6 -2.5483e-8 * lat^5 -2.116389e-6 * lat^4 +2.5858636e-5 * lat^3 +3.483879e-3 * lat^2 -1.417675 * lat + 221.9496

Seems complicate but it works; the error max is less than 2 pixels.
Simply copy and paste this line into Annex and that's all.

Code: [Local Link Removed for Guests]

lat	|	  y	|	   ypoly6
===============================
-60	|	319	|	319.3412732
-45	|	290	|	288.778745
-30	|	265	|	266.0250102
-15	|	243	|	243.8266594
0	|	223	|	221.949551
15	|	202	|	201.4322453
30	|	181	|	181.1223806
45	|	155	|	156.4959924
60	|	122	|	120.7597748
75	|	68	|	68.23628393
90	|	0	|	0.032084131