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 82: | Linha 82: | ||
* [http://www.anycalculator.com/decimaltodegree.htm Convert Degrees Minutes Seconds to Decimal Degrees] | * [http://www.anycalculator.com/decimaltodegree.htm Convert Degrees Minutes Seconds to Decimal Degrees] | ||
* [http://transition.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html/ Degrees, Minutes, Seconds and Decimal Degrees Latitude/Longitude Conversions] | * [http://transition.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html/ Degrees, Minutes, Seconds and Decimal Degrees Latitude/Longitude Conversions] | ||
+ | |||
+ | <html> | ||
+ | <div class="maincontent"> | ||
+ | |||
+ | |||
+ | <script type="text/javascript" language="JavaScript"> | ||
+ | |||
+ | <!-- Hide JavaScript from Java-Impaired Browsers | ||
+ | var defaultEmptyOK = true; | ||
+ | var decimalPointDelimiter = "."; | ||
+ | function isDigit (c) | ||
+ | { return ((c >= "0") && (c <= "9")) } | ||
+ | function isEmpty(s) | ||
+ | { return ((s == null) || (s.length == 0)); } | ||
+ | function isFloat (s) | ||
+ | { var i; | ||
+ | var seenDecimalPoint = false; | ||
+ | if (isEmpty(s)) | ||
+ | if (isFloat.arguments.length == 1) return defaultEmptyOK; | ||
+ | else return (isFloat.arguments[1] == true); | ||
+ | if (s == decimalPointDelimiter) return false; | ||
+ | for (i = 0; i < s.length; i++) | ||
+ | { var c = s.charAt(i); | ||
+ | if ((c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true; | ||
+ | else if (!isDigit(c)) return false; | ||
+ | } | ||
+ | return true; | ||
+ | } | ||
+ | function isSignedFloat (s) | ||
+ | { if (isEmpty(s)) | ||
+ | if (isSignedFloat.arguments.length == 1) return defaultEmptyOK; | ||
+ | else return (isSignedFloat.arguments[1] == true); | ||
+ | else { | ||
+ | var startPos = 0; | ||
+ | var secondArg = defaultEmptyOK; | ||
+ | if (isSignedFloat.arguments.length > 1) | ||
+ | secondArg = isSignedFloat.arguments[1]; | ||
+ | if ( (s.charAt(0) == "-") || (s.charAt(0) == "+") ) | ||
+ | startPos = 1; | ||
+ | return (isFloat(s.substring(startPos, s.length), secondArg)) | ||
+ | } | ||
+ | } | ||
+ | function warnInvalid (theField, s) | ||
+ | { theField.focus() | ||
+ | theField.select() | ||
+ | alert(s) | ||
+ | return false | ||
+ | } | ||
+ | function convert(form) { | ||
+ | with (form) { | ||
+ | if (!(isSignedFloat (DEG.value))) { | ||
+ | warnInvalid (DEG, "Degrees need to be a Numerical value (Between 0 and 60) "); return false; } | ||
+ | if (!(isSignedFloat (MIN.value))) { | ||
+ | warnInvalid (MIN, "Minutes need to be a Numerical value (Between 0 and 60) "); return false; } | ||
+ | if (!(isSignedFloat (SEC.value))) { | ||
+ | warnInvalid (SEC, "Seconds need to be a Numerical value (Between 0 and 60) "); return false; } | ||
+ | if (SEC.value > 60) { | ||
+ | warnInvalid (SEC, "Seconds need to be a Numerical value (Between 0 and 60) "); return false; } | ||
+ | if (SEC.value < 0) { | ||
+ | warnInvalid (SEC, "Seconds need to be a Numerical value (Between 0 and 60) "); return false; } | ||
+ | if (MIN.value > 60) { | ||
+ | warnInvalid (MIN, "Minutes need to be a Numerical value (Between 0 and 60) "); return false; } | ||
+ | if (MIN.value < 0) { | ||
+ | warnInvalid (MIN, "Minutes need to be a Numerical value (Between 0 and 60) "); return false; } | ||
+ | if (DEG.value < 0 ) { | ||
+ | output.value = (Math.ceil( ((DEG.value * 1) - (MIN.value / 60) - (SEC.value / 3600)) * 10000)) / 10000 ; } | ||
+ | else { | ||
+ | output.value = (Math.floor( ((DEG.value * 1) + (MIN.value / 60) + (SEC.value / 3600)) * 10000)) / 10000; } | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | // End Hiding --> | ||
+ | </script> | ||
+ | |||
+ | <form onsubmit="return convert(this)" action=""> | ||
+ | <center> | ||
+ | <table border="1"> | ||
+ | <tbody> | ||
+ | <tr> | ||
+ | <td align="center"><strong> Degrees Minutes Seconds to Decimal Degrees </strong></td></tr> | ||
+ | |||
+ | <tr> | ||
+ | <td valign="middle" align="center"> | ||
+ | <p align="center">Degrees Minutes Seconds <input size="3" name="DEG">° <input size="3" name="MIN">' <input size="3" name="SEC">" </p></td></tr> | ||
+ | <tr> | ||
+ | <td valign="top" align="center"><input type="submit" value=" Click for Conversion "> <input type="reset" value=" Reset Values "></td></tr> | ||
+ | <tr> | ||
+ | <td valign="top" align="center"><input size="30" name="output"></td></tr></tbody></table></center></form> | ||
+ | |||
+ | |||
+ | </div> | ||
+ | </html> |
Edição das 20h22min 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
- Calculate distance, bearing and more between two latitude/longitude points
- Convert Degrees Minutes Seconds to Decimal Degrees
- Degrees, Minutes, Seconds and Decimal Degrees Latitude/Longitude Conversions
<html>
<script type="text/javascript" language="JavaScript">
</script>
<form onsubmit="return convert(this)" action="">
Degrees Minutes Seconds to Decimal Degrees |
Degrees Minutes Seconds <input size="3" name="DEG">° <input size="3" name="MIN">' <input size="3" name="SEC">" |
<input type="submit" value=" Click for Conversion "> <input type="reset" value=" Reset Values "> |
<input size="30" name="output"> |
</html>