Mudanças entre as edições de "Fundamentação Teórica do Projeto - O Sistema GPS e métodos para cálculo de área e distância"
Linha 78: | Linha 78: | ||
=Conversor de decimal para graus.minutos.segundos= | =Conversor de decimal para graus.minutos.segundos= | ||
− | *http://transition.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html/ | + | <html> |
+ | <table summary="" border="0" width="610" cellpadding="7" bgcolor="#FECBAF"> | ||
+ | |||
+ | <tbody><tr><td class="bodytext"> | ||
+ | <label class="bodytext" for="DMSlat"><nobr>Entre a latitude em Graus Minutos Segundos: </nobr></label></td> | ||
+ | <td class="bodytext"> | ||
+ | <nobr> | ||
+ | <input name="dlat" type="INT" size="4" value="" maxlength="4" id="DMSlat" style="font-size: 12pt" tabindex="1" onblur=" | ||
+ | |||
+ | |||
+ | if(form10.dlat.value < 0) { latsign = -1; } | ||
+ | absdlat = Math.abs( Math.round(form10.dlat.value * 1000000.)); | ||
+ | |||
+ | //Math.round is used to eliminate the small error caused by rounding in the computer: | ||
+ | //e.g. 0.2 is not the same as 0.20000000000284 | ||
+ | |||
+ | //Error checks | ||
+ | if(absdlat > (90 * 1000000)) { alert(' Degrees Latitude must be in the range of -90 to 90. '); form10.dlat.value = ''; form10.dlat.value=''; form10.mlat.value=''; } | ||
+ | |||
+ | "> <input name="mlat" type="INT" size="4" value="" maxlength="2" id="DMSlat" style="font-size: 12pt" tabindex="2" onblur=" | ||
+ | |||
+ | form10.mlat.value = Math.abs(Math.round(form10.mlat.value * 1000000.)/1000000); //integer | ||
+ | absmlat = Math.abs(Math.round(form10.mlat.value * 1000000.)); //integer | ||
+ | |||
+ | //Error checks | ||
+ | if(absmlat >= (60 * 1000000)) { alert(' Minutes Latitude must be in the range of 0 to 59. '); form10.mlat.value=''; form10.slat.value=''; } | ||
+ | |||
+ | |||
+ | "> <input name="slat" type="INT" size="6" value="" maxlength="6" id="DMSlat" style="font-size: 12pt" tabindex="3" onblur=" | ||
+ | |||
+ | form10.slat.value = Math.abs(Math.round(form10.slat.value * 1000000.)/1000000); | ||
+ | absslat = Math.abs(Math.round(form10.slat.value * 1000000.)); // Note: kept as big integer for now, even if submitted as decimal | ||
+ | |||
+ | //Error checks | ||
+ | if(absslat > (59.99999999 * 1000000)) { alert(' Minutes Latitude must be 0 or greater \n and less than 60. '); form10.slat.value=''; } | ||
+ | |||
+ | "></nobr></td></tr> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | <tr><td class="bodytext"> | ||
+ | <label class="bodytext" for="DMSlon"><nobr>Entre a longitude em Graus Minutos: </nobr></label></td> | ||
+ | <td class="bodytext"> | ||
+ | <nobr> | ||
+ | <input name="dlon" type="INT" size="4" value="" maxlength="4" id="DMSlon" style="font-size: 12pt" tabindex="4" onblur=" | ||
+ | |||
+ | if(form10.dlon.value < 0) { lonsign = -1; } | ||
+ | absdlon = Math.abs( Math.round(form10.dlon.value * 1000000.)); | ||
+ | |||
+ | //Math.round is used to eliminate the small error caused by rounding in the computer: | ||
+ | //e.g. 0.2 is not the same as 0.20000000000284 | ||
+ | |||
+ | //Error checks | ||
+ | if(absdlon > (180 * 1000000)) { alert(' Degrees Longitude must be in the range of -180 to 180. '); form10.dlon.value=''; form10.mlon.value='';} | ||
+ | |||
+ | |||
+ | |||
+ | "> <input name="mlon" type="INT" size="4" value="" maxlength="2" id="DMSlon" style="font-size: 12pt" tabindex="5" onblur=" | ||
+ | |||
+ | form10.mlon.value = Math.abs(Math.round(form10.mlon.value * 1000000.)/1000000); //integer | ||
+ | absmlon = Math.abs(Math.round(form10.mlon.value * 1000000)); //integer | ||
+ | //Error checks | ||
+ | if(absmlon >= (60 * 1000000)) { alert(' Minutes Longitude must be in the range of 0 to 59. '); form10.mlon.value=''; form10.slon.value=''; } | ||
+ | |||
+ | |||
+ | "> <input name="slon" type="INT" size="6" value="" maxlength="6" id="DMSlon" style="font-size: 12pt" tabindex="6" onblur=" | ||
+ | |||
+ | form10.slon.value = Math.abs(Math.round(form10.slon.value * 1000000.)/1000000); | ||
+ | absslon = Math.abs(Math.round(form10.slon.value * 1000000.)); // Note: kept as big integer for now, even if submitted as decimal | ||
+ | |||
+ | //Error checks | ||
+ | if(absslon > (59.99999999 * 1000000)) { alert(' Minutes Latitude must be 0 or greater \n and less than 60. '); form10.slon.value=''; } | ||
+ | |||
+ | "></nobr></td></tr> | ||
+ | |||
+ | <tr><td colspan="2" align="center"> | ||
+ | |||
+ | <input name="submit" type="BUTTON" size="37" tabindex="7" style="background-color: #DDEFFF;" value=" Convert to Decimal " onclick=" | ||
+ | |||
+ | form10.alat.value = Math.round(absdlat + (absmlat/60.) + (absslat/3600.) ) * latsign/1000000; | ||
+ | form10.alon.value = Math.round(absdlon + (absmlon/60) + (absslon/3600) ) * lonsign/1000000; | ||
+ | latsign=1; | ||
+ | lonsign=1; | ||
+ | |||
+ | "> <input type="reset" value="Clear Values" tabindex="8" onclick=" | ||
+ | |||
+ | form10.reset; | ||
+ | absdlat=0; | ||
+ | absdlon=0; | ||
+ | absmlat=0; | ||
+ | absmlon=0; | ||
+ | absslat=0; | ||
+ | absslon=0; | ||
+ | form10.alat.value=0; | ||
+ | form10.alon.value=0; | ||
+ | |||
+ | "></td></tr> | ||
+ | |||
+ | <tr><td colspan="2" align="right"> <nobr><b class="bodytextbold">Results:</b> Latitude: | ||
+ | <input name="alat" type="INT" size="17" value="" maxlength="17" id="alat" style="font-size: 12pt; background-color: #EEEEAB" tabindex="9"> Longitude: | ||
+ | <input name="alon" type="INT" size="17" value="" maxlength="17" id="alon" style="font-size: 12pt; background-color: #EEEEAB" tabindex="10"> </nobr> | ||
+ | |||
+ | </td></tr></tbody></table> | ||
+ | </html> | ||
+ | FONTE: http://transition.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html/ |
Edição das 19h14min de 4 de julho de 2012
Como adquirir o sinal do GPS no Android
No projeto adicione o LocationSensor ao projeto, altere as propriedades desse objeto para Enabled [x] ProviderLocked [x] ProviderName gps em minusculo (pois GPS em maiúsculo não funciona)
Em seguida obtenha as medidas do GPS usando:
Método 1
Aguarde o disparo do evento when LocationSensor1.LocationChanged e utilize os valores retornados nas variáveis locais latitude, longitude e altitude.
- Neste caso, cada vez que houver mudança na posição do GPS, um novo evento ocorre e novos dados de localização são recebidos. Esse método fornece poucas medidas do GPS mesmo quando a sua posição é alterada. Aparentemente após o disparo do evento o chip é desligado temporariamente.
Método 2
Para aumentar a velocidade das medições do GPS, inclua um Clock1 no projeto e configure as propriedades para disparar a cada 1 segundo, TimerAlwaysFires [x] TimerEnabled [x] TimerInterval 1000
Aguarde o disparo do evento when Clcck1.Timer e leia os valores das variáveis LocationSensor1.Latitude, LocationSensor1.Longitude e LocationSensor1.Altitude.
- Neste caso, a cada segundo, independente de haver mudança na posição do GPS, um novo evento do timer ocorre e novos dados de localização são recebidos.
- Note que mesmo sem alterar a posição do GPS os dados recebidos sofrem variação.
Método 3
Pode acontecer que no método 2 o chip não atualize os dados a cada leitura. Neste caso, após efetuar a leitura, é necessário desabilitar temporariamente o GPS LocationSensor1.Enable = False, e seguida habilita-lo LocationSensor1.Enable = True esperando novamente 1 segundo antes da próxima leitura
Independente do método utilizado, é possível obter a exatidão da medida da localização lendo o valor da variável LocationSensor1.Accuracy. Usando um conjunto maior de aquisições da localização em um mesmo ponto é possível melhorar a precisão da medição usando uma média de valores.
Como calcular a distância entre dois pontos
Se você tiver a localização dada em coordenadas de latitude e longitude de dois pontos e sobre o globo terrestre, pode calcular a distancia entre eles usando diferentes métodos
Método 1
Um método é o cálculo da distância geodésica , o qual considera a distância percorrida sobre uma esfera com raio equivalente ao raio médio da terra .
FONTE: http://mathworld.wolfram.com/GreatCircle.html, http://obsn3.on.br/~jlkm/geopath/
Método 2
Um segundo método é transformar as coordenadas geográficas em coordenadas no plano cartesiano e :
e calcular a distância euclidiana entre os pontos:
Note que este método calcula a distância em linha reta, e é uma aproximação da distância real quando seu valor é pequeno em relação a curvatura da terra (< 1000 km).
FONTE: http://mathworld.wolfram.com/Distance.html
Como calcular a área de um triângulo
Veja os possíveis métodos no site Wolfram Mathword.
Campo de Experimentos PJI1
No pátio do estacionamento do IF-SC estão marcados 3 pontos que formam um triângulo (P1,P2,P3). Estes pontos servem de referência inicial para a verificação de funcionamento dos sistemas desenvolvidos no PJI1. As latitudes e longitudes desses pontos com medição através do GPS Garmim 76CSx, resultaram em:
- P1 = [-27.608417,-48.632750]
- P2 = [-27.608611,-48.632889]
- P3 = [-27.608556,-48.632639]
A medida da distância entre os pontos usando uma trena de fibra resultou na distância de:
- d(P1,P2) = 27,00 m2
- d(P1,P3) = 22,30 m2
- d(P2,P3) = 20,65 m2
Utilizando a fórmula de Heron obteve-se:
- Area(P1,P2,P3) = 225,04 m2
Conversor de decimal para graus.minutos.segundos
<html>
<tbody></tbody><label class="bodytext" for="DMSlat"><nobr>Entre a latitude em Graus Minutos Segundos: </nobr></label> |
<nobr> <input name="dlat" type="INT" size="4" value="" maxlength="4" id="DMSlat" style="font-size: 12pt" tabindex="1" onblur="
if(form10.dlat.value < 0) { latsign = -1; } absdlat = Math.abs( Math.round(form10.dlat.value * 1000000.)); //Math.round is used to eliminate the small error caused by rounding in the computer: //e.g. 0.2 is not the same as 0.20000000000284 //Error checks if(absdlat > (90 * 1000000)) { alert(' Degrees Latitude must be in the range of -90 to 90. '); form10.dlat.value = ; form10.dlat.value=; form10.mlat.value=; } "> <input name="mlat" type="INT" size="4" value="" maxlength="2" id="DMSlat" style="font-size: 12pt" tabindex="2" onblur=" form10.mlat.value = Math.abs(Math.round(form10.mlat.value * 1000000.)/1000000); //integer absmlat = Math.abs(Math.round(form10.mlat.value * 1000000.)); //integer //Error checks if(absmlat >= (60 * 1000000)) { alert(' Minutes Latitude must be in the range of 0 to 59. '); form10.mlat.value=; form10.slat.value=; }
"> <input name="slat" type="INT" size="6" value="" maxlength="6" id="DMSlat" style="font-size: 12pt" tabindex="3" onblur=" form10.slat.value = Math.abs(Math.round(form10.slat.value * 1000000.)/1000000); absslat = Math.abs(Math.round(form10.slat.value * 1000000.)); // Note: kept as big integer for now, even if submitted as decimal //Error checks if(absslat > (59.99999999 * 1000000)) { alert(' Minutes Latitude must be 0 or greater \n and less than 60. '); form10.slat.value=; }"></nobr> |
<label class="bodytext" for="DMSlon"><nobr>Entre a longitude em Graus Minutos: </nobr></label> |
<nobr> <input name="dlon" type="INT" size="4" value="" maxlength="4" id="DMSlon" style="font-size: 12pt" tabindex="4" onblur=" if(form10.dlon.value < 0) { lonsign = -1; } absdlon = Math.abs( Math.round(form10.dlon.value * 1000000.)); //Math.round is used to eliminate the small error caused by rounding in the computer: //e.g. 0.2 is not the same as 0.20000000000284 //Error checks if(absdlon > (180 * 1000000)) { alert(' Degrees Longitude must be in the range of -180 to 180. '); form10.dlon.value=; form10.mlon.value=;}
"> <input name="mlon" type="INT" size="4" value="" maxlength="2" id="DMSlon" style="font-size: 12pt" tabindex="5" onblur=" form10.mlon.value = Math.abs(Math.round(form10.mlon.value * 1000000.)/1000000); //integer absmlon = Math.abs(Math.round(form10.mlon.value * 1000000)); //integer //Error checks if(absmlon >= (60 * 1000000)) { alert(' Minutes Longitude must be in the range of 0 to 59. '); form10.mlon.value=; form10.slon.value=; }
"> <input name="slon" type="INT" size="6" value="" maxlength="6" id="DMSlon" style="font-size: 12pt" tabindex="6" onblur=" form10.slon.value = Math.abs(Math.round(form10.slon.value * 1000000.)/1000000); absslon = Math.abs(Math.round(form10.slon.value * 1000000.)); // Note: kept as big integer for now, even if submitted as decimal //Error checks if(absslon > (59.99999999 * 1000000)) { alert(' Minutes Latitude must be 0 or greater \n and less than 60. '); form10.slon.value=; }"></nobr> |
<input name="submit" type="BUTTON" size="37" tabindex="7" style="background-color: #DDEFFF;" value=" Convert to Decimal " onclick=" form10.alat.value = Math.round(absdlat + (absmlat/60.) + (absslat/3600.) ) * latsign/1000000; form10.alon.value = Math.round(absdlon + (absmlon/60) + (absslon/3600) ) * lonsign/1000000; latsign=1; lonsign=1; "> <input type="reset" value="Clear Values" tabindex="8" onclick=" form10.reset; absdlat=0; absdlon=0; absmlat=0; absmlon=0; absslat=0; absslon=0; form10.alat.value=0; form10.alon.value=0; "> | |
<nobr>Results: Latitude:
<input name="alat" type="INT" size="17" value="" maxlength="17" id="alat" style="font-size: 12pt; background-color: #EEEEAB" tabindex="9"> Longitude: <input name="alon" type="INT" size="17" value="" maxlength="17" id="alon" style="font-size: 12pt; background-color: #EEEEAB" tabindex="10"> </nobr> |
</html> FONTE: http://transition.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html/