huogerac / trot-geo-tracking

Aplicação para salvar trajetos de trots
https://trot-geo-tracking-brown.vercel.app
10 stars 7 forks source link

Definir como visualizar uma lista de posições no mapa #8

Open huogerac opened 1 year ago

huogerac commented 1 year ago

Precisamos pesquisar e descobrir uma biblioteca interessante para exibir os dados das posições salvas de um percurso.

Alguns links:

huogerac commented 1 year ago

A página que queremos produzir pode estar nesta linha: Entrada: Uma lista de posições vindas do backend conforme um determinado trajeto Saída: image

huogerac commented 1 year ago

Pessoal, Pensei em testar esta aqui primeiro: https://vue3openlayers.netlify.app/componentsguide/geometries/geomlinestring/

huogerac commented 1 year ago

Para utilizar como tabela verdade ou parâmetro de comparação, fiz um trajeto a pé com o app ligado, segue em roxo o percurso real que eu fiz:

Percurso real marcado manualmente

image

Pontos salvos pelo app:

latitude:-23.2411977 longitude:-45.9120481 heading: speed: altitude:607.6000366210938
Posições: 19
(-23.2393818, -45.9105859)
(-23.2395042, -45.9108546)
(-23.239854, -45.9108956)
(-23.2395438, -45.9110415)
(-23.2397099, -45.9109698)
(-23.2399204, -45.9108708)
(-23.240154, -45.9112224)
(-23.2404938, -45.9117616)
(-23.2407264, -45.9116364)
(-23.2410965, -45.9115806)
(-23.2412156, -45.9120134)
(-23.2415228, -45.9120774)
(-23.2416025, -45.9120839)
(-23.2410723, -45.9120789)
(-23.2418602, -45.9126057)
(-23.2417944, -45.9131255)
(-23.2413584, -45.9131271)
(-23.2413335, -45.9126207)
(-23.2411977, -45.9120481)
huogerac commented 1 year ago

Caminho percorrido

Foi exatamente a linha roxa do post acima

Caminho registrado pelo app:

image

Pontos registrado pelo app:

{ "latitude": -23.2409536, "longitude": -45.9121078, "latLongAccuracy": 13.57800006866455, "heading": 295.1629638671875, "speed": 0.20608435571193695, "altitude": 652.1000366210938, "altitudeAccuracy": null, "date": 1675377515620 }

{ "latitude": -23.2416081, "longitude": -45.9120299, "latLongAccuracy": 17.934999465942383, "heading": null, "speed": null, "altitude": 607.7000122070312, "altitudeAccuracy": null, "date": 1675377516724 }

{ "latitude": -23.2416248, "longitude": -45.9119748, "latLongAccuracy": 18.601999282836914, "heading": 108.25753784179688, "speed": 0.7250559329986572, "altitude": 607.7000122070312, "altitudeAccuracy": null, "date": 1675377521721 }

{ "latitude": -23.2416928, "longitude": -45.9120526, "latLongAccuracy": 18.60700035095215, "heading": 224.9650115966797, "speed": 1.2728019952774048, "altitude": 607.800048828125, "altitudeAccuracy": null, "date": 1675377530028 }

{ "latitude": -23.2418495, "longitude": -45.9120493, "latLongAccuracy": 19.075000762939453, "heading": 179.93734741210938, "speed": 3.285896062850952, "altitude": 608.800048828125, "altitudeAccuracy": null, "date": 1675377534823 }

{ "latitude": -23.2419192, "longitude": -45.9121085, "latLongAccuracy": 28.45800018310547, "heading": 211.84237670898438, "speed": 2.041212558746338, "altitude": 609, "altitudeAccuracy": null, "date": 1675377539814 }

{ "latitude": -23.2413851, "longitude": -45.9124332, "latLongAccuracy": 51.4119987487793, "heading": 329.245361328125, "speed": 11.09304141998291, "altitude": 618.300048828125, "altitudeAccuracy": null, "date": 1675377544996 }

{ "latitude": -23.2411504, "longitude": -45.9123269, "latLongAccuracy": 40.56800079345703, "heading": 358.2041015625, "speed": 7.416371822357178, "altitude": 608.5, "altitudeAccuracy": null, "date": 1675377550778 }

{ "latitude": -23.2419087, "longitude": -45.9125371, "latLongAccuracy": 17.422000885009766, "heading": 195.81150817871094, "speed": 11.512879371643066, "altitude": 608.6000366210938, "altitudeAccuracy": null, "date": 1675377554824 }

{ "latitude": -23.2419433, "longitude": -45.9125407, "latLongAccuracy": 13.09000015258789, "heading": 191.2939453125, "speed": 1.5806524753570557, "altitude": 608.800048828125, "altitudeAccuracy": null, "date": 1675377559882 }

{ "latitude": -23.2419223, "longitude": -45.9126106, "latLongAccuracy": 18.982999801635742, "heading": 283.6253967285156, "speed": 1.4148142337799072, "altitude": 608.800048828125, "altitudeAccuracy": null, "date": 1675377564907 }

{ "latitude": -23.241894, "longitude": -45.9126789, "latLongAccuracy": 15.437999725341797, "heading": 292.7967834472656, "speed": 1.5012714862823486, "altitude": 609.9000244140625, "altitudeAccuracy": null, "date": 1675377569948 }

{ "latitude": -23.241845, "longitude": -45.9127282, "latLongAccuracy": 21.152000427246094, "heading": 315.3138122558594, "speed": 1.2851178646087646, "altitude": 609.1000366210938, "altitudeAccuracy": null, "date": 1675377575768 }

{ "latitude": -23.2419117, "longitude": -45.9129173, "latLongAccuracy": 21.983999252319336, "heading": 251.10858154296875, "speed": 4.340336322784424, "altitude": 609.1000366210938, "altitudeAccuracy": null, "date": 1675377579935 }

{ "latitude": -23.2412824, "longitude": -45.9125809, "latLongAccuracy": 24.566999435424805, "heading": 24.12602996826172, "speed": 12.760014533996582, "altitude": 608.9000244140625, "altitudeAccuracy": null, "date": 1675377584957 }

{ "latitude": -23.2417123, "longitude": -45.9128319, "latLongAccuracy": 39.422000885009766, "heading": 209.205078125, "speed": 7.4409918785095215, "altitude": 609, "altitudeAccuracy": null, "date": 1675377589957 }

{ "latitude": -23.2419848, "longitude": -45.9131379, "latLongAccuracy": 22.746999740600586, "heading": 222.4768829345703, "speed": 8.335498809814453, "altitude": 609.300048828125, "altitudeAccuracy": null, "date": 1675377594983 }

{ "latitude": -23.2417554, "longitude": -45.9131613, "latLongAccuracy": 13.602999687194824, "heading": 343.34912109375, "speed": 3.8760197162628174, "altitude": 608.9000244140625, "altitudeAccuracy": null, "date": 1675377600041 }

{ "latitude": -23.2417208, "longitude": -45.9131752, "latLongAccuracy": 14.041999816894531, "heading": 340.6460876464844, "speed": 1.0308403968811035, "altitude": 608.9000244140625, "altitudeAccuracy": null, "date": 1675377605025 }

{ "latitude": -23.2416369, "longitude": -45.913189, "latLongAccuracy": 53.82099914550781, "heading": 350.9261779785156, "speed": 1.7959867715835571, "altitude": 608.9000244140625, "altitudeAccuracy": null, "date": 1675377610107 }

{ "latitude": -23.2416485, "longitude": -45.9131972, "latLongAccuracy": 50.1879997253418, "heading": 329.5452880859375, "speed": 0.3991379737854004, "altitude": 608.9000244140625, "altitudeAccuracy": null, "date": 1675377615113 }

{ "latitude": -23.241503, "longitude": -45.9131522, "latLongAccuracy": 14.508000373840332, "heading": 14.0953950881958, "speed": 2.5208547115325928, "altitude": 608.5, "altitudeAccuracy": null, "date": 1675377620073 }

{ "latitude": -23.2414999, "longitude": -45.9131409, "latLongAccuracy": 13.494000434875488, "heading": 48.42793273925781, "speed": 0.34333375096321106, "altitude": 608.5, "altitudeAccuracy": null, "date": 1675377625118 }

{ "latitude": -23.2414798, "longitude": -45.9131268, "latLongAccuracy": 14.822999954223633, "heading": 33.48370361328125, "speed": 0.5191359519958496, "altitude": 608.2000122070312, "altitudeAccuracy": null, "date": 1675377630107 }

{ "latitude": -23.2414253, "longitude": -45.9131324, "latLongAccuracy": 14.487000465393066, "heading": 355.9891662597656, "speed": 1.125038504600525, "altitude": 608.2000122070312, "altitudeAccuracy": null, "date": 1675377635165 }

{ "latitude": -23.2413413, "longitude": -45.9130987, "latLongAccuracy": 15.175999641418457, "heading": 19.18520736694336, "speed": 1.933532476425171, "altitude": 608.2000122070312, "altitudeAccuracy": null, "date": 1675377640122 }

{ "latitude": -23.2413291, "longitude": -45.9130439, "latLongAccuracy": 24.840999603271484, "heading": 69.16045379638672, "speed": 1.151485800743103, "altitude": 608.2000122070312, "altitudeAccuracy": null, "date": 1675377645129 }

{ "latitude": -23.2412186, "longitude": -45.9131583, "latLongAccuracy": 21.177000045776367, "heading": 319.6227111816406, "speed": 2.8188693523406982, "altitude": 607.9000244140625, "altitudeAccuracy": null, "date": 1675377650186 }

{ "latitude": -23.2412319, "longitude": -45.9129841, "latLongAccuracy": 25.489999771118164, "heading": 90.09587097167969, "speed": 2.904677152633667, "altitude": 608, "altitudeAccuracy": null, "date": 1675377655179 }

{ "latitude": -23.241251, "longitude": -45.9126543, "latLongAccuracy": 11.916999816894531, "heading": 93.3869400024414, "speed": 6.185420989990234, "altitude": 607.9000244140625, "altitudeAccuracy": null, "date": 1675377662025 }

{ "latitude": -23.2412639, "longitude": -45.9126427, "latLongAccuracy": 12.824999809265137, "heading": 98.62506103515625, "speed": 2.0535223484039307, "altitude": 607.9000244140625, "altitudeAccuracy": null, "date": 1675377665244 }

{ "latitude": -23.2412937, "longitude": -45.9126323, "latLongAccuracy": 16.285999298095703, "heading": 112.17929077148438, "speed": 1.2613600492477417, "altitude": 607.800048828125, "altitudeAccuracy": null, "date": 1675377670259 }

{ "latitude": -23.2412357, "longitude": -45.9126535, "latLongAccuracy": 14.760000228881836, "heading": 77.39408874511719, "speed": 0.6275585293769836, "altitude": 607.800048828125, "altitudeAccuracy": null, "date": 1675377675293 }

{ "latitude": -23.241274, "longitude": -45.9126265, "latLongAccuracy": 13.885000228881836, "heading": 103.20944213867188, "speed": 0.6131636500358582, "altitude": 607.800048828125, "altitudeAccuracy": null, "date": 1675377682047 }

{ "latitude": -23.2412774, "longitude": -45.9126006, "latLongAccuracy": 17.23900032043457, "heading": 102.1618881225586, "speed": 0.5914096832275391, "altitude": 607.800048828125, "altitudeAccuracy": null, "date": 1675377685336 }

{ "latitude": -23.2412637, "longitude": -45.9125856, "latLongAccuracy": 14.152000427246094, "heading": 93.87068939208984, "speed": 0.5223310589790344, "altitude": 607.800048828125, "altitudeAccuracy": null, "date": 1675377690353 }

{ "latitude": -23.2412482, "longitude": -45.912603, "latLongAccuracy": 15.413000106811523, "heading": 83.9872055053711, "speed": 0.35541799664497375, "altitude": 607.800048828125, "altitudeAccuracy": null, "date": 1675377695373 }

{ "latitude": -23.2412615, "longitude": -45.912601, "latLongAccuracy": 16.406999588012695, "heading": 94.28681945800781, "speed": 0.2995222806930542, "altitude": 607.800048828125, "altitudeAccuracy": null, "date": 1675377702049 }

{ "latitude": -23.2412377, "longitude": -45.9126277, "latLongAccuracy": 13.267999649047852, "heading": 64.82176971435547, "speed": 0.16866658627986908, "altitude": 607.9000244140625, "altitudeAccuracy": null, "date": 1675377705412 }

{ "latitude": -23.2412608, "longitude": -45.9126012, "latLongAccuracy": 14.130999565124512, "heading": 97.14669799804688, "speed": 0.21996979415416718, "altitude": 607.800048828125, "altitudeAccuracy": null, "date": 1675377710410 }

{ "latitude": -23.241288, "longitude": -45.9125738, "latLongAccuracy": 15.779999732971191, "heading": 114.2422103881836, "speed": 0.3019716441631317, "altitude": 607.800048828125, "altitudeAccuracy": null, "date": 1675377715444 }

{ "latitude": -23.2412962, "longitude": -45.9125738, "latLongAccuracy": 18.299999237060547, "heading": 120.16838073730469, "speed": 0.2678869068622589, "altitude": 607.800048828125, "altitudeAccuracy": null, "date": 1675377722026 }

huogerac commented 1 year ago

Problema:

Próximas ações

HenriqueCCdA commented 1 year ago

Aqui tem como aumentar a precisão eu acho

https://w3c.github.io/geolocation-api/#enablehighaccuracy-member

JonathansManoel commented 1 year ago

Salvamento automático em caso de acabar a bateria!

joaoprocopio commented 1 year ago

doc do android sobre acessar permissões de localização com acurácia alta

huogerac commented 1 year ago

Link interessante https://www.storelocatorwidgets.com/blogpost/20453/Everything_you_ever_wanted_to_know_about_HTML5_Geolocation_Accuracy#:~:text=GPS%20(Global%20Positioning%20System)&text=Accuracy%20is%20excellent%20%2D%20typically%20a,point%20on%20the%20Earth's%20surface.

rafaelatwwf commented 1 year ago

No momento o app plota os pontos/linhas em um mapa que usa crs WGS84 epsg: 4326, porém essa crs não é a ideal para visualização, ela destorce partes do globo terrestre, principalmente nas regiões mais distantes da linha do equador. Vejam abaixo como fica o mapa para a Alemanha, no app (primeira imagem) e como deveria ser (segunda imagem). As duas imagens cobrem a mesma area! Screenshot_20230211-174708-689

Screen Shot 2023-02-17 at 22 22 35
rafaelatwwf commented 1 year ago

Recomendo transformar os pontos coletados (usando geopandas ou postgis) para a crs WGS84 Pseudo-Mercator (também chamada Web Mercator) epsg:3857 e depois plotá-los em um mapa de mesma crs.