IBPindex

  • Aumentar fuente
  • Fuente predeterminada
  • Disminuir fuente
Inicio Manual Ejemplo en php

Ejemplo en php

E-mail Imprimir

 Manual para integrar el Índice IBP en aplicaciones de escritorio

 

Para acceder desde un programa o Web al índice IBP se deben seguir los siguientes pasos: 
 
Leer el archivo que contiene los datos de la ruta GPS (track). 
 
Simplemente accediendo al archivo y leyendo todo su contenido. 

Ejemplo en php  ( escrito por Alex Barros  www.gpsia.com )

ibp.class.php

<?php
// Class for getting the IBPIndex given a local filename, further information on http://www.ibpindex.com
// By Alex Barros for Gpsia software. License: GNU/GPL v3
// Requirements: PHP + Curl


define('IBP_TMP', '/tmp'); //temporary folder with 777 chmod permission

class IBP {
    var $filename; //Source filename
    var $ibp; //Resoult: NN XX (N=number X =alphabetic)
   
    function IBP($filename = false){ //Constructor
        if(!empty($filename)) $this->getIBP($filename);
    }
    function getIBP($filename) {
        if(strlen(basename($filename)) > 55) { //filenames are limited
            $filename = $this->shortenName($filename); //Makes a copy with shorter filename in the temporary folder
            $isTmp = true;
        }
       
        $this->filename = $filename;
       
        if(file_exists($filename)) {
            //Post fields
            $post_data = array();
            $post_data['fichero'] = "@$filename";
            $post_data['MOD'] = 'BTT';
            $post_data['UDO'] = 'Gpsia';
           
            //Curl connection
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, "http://www.ibpindex.com/esp/ibpresponse.asp" );
            curl_setopt($ch, CURLOPT_POST, 1 );
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //Needed because redirection is used on the app
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            $postResult = curl_exec($ch); //return result
           
            if (curl_errno($ch)) {
                die(curl_error($ch)); //this stops the execution under a Curl failure
            }
           
            curl_close($ch); //close connection
           
            $this->ibp = $postResult;
           
            if($isTmp) @unlink($filename); //remove temporary file
           
            return $postResult;
        }
    }
    function shortenName($filename) {
        $newName = IBP_TMP.'/IBP-'.substr(basename($filename),-20); //new shorter temporary filename
        if(file_put_contents($newName, file_get_contents($filename)))
            return $newName;
        return false;
    }
}

# usage: $ibp = new IBP('path/to/file.gpx'); echo $ibp->ibp; //Returns something like 696 AB

?>

 

 

Por qué no coinciden los metros acumulados con mis datos 

los receptores GPS tienen tendencia a acumular algunos metros de mas tanto de subida como de bajada debido a los vaivenes.

El total de metros acumulados de subida y de bajada que muestra IBPindex es en el primer análisis (analisis reparado) es estrictamente la suma de los registros del GPS.

En un segundo análisis (análisis optimizado) el sistema IBPindex aplica un corrector de desnivel dejando este valor mucho mas cerca de la realidad.

los receptores más modernos son cada vez más precisos y por tanto cada vez acumulan menos error.