how to know the location of the GPS in xbase

This forum is for eXpress++ general support.
Message
Author
User avatar
digitsoft
Posts: 461
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

how to know the location of the GPS in xbase

#1 Post by digitsoft »

GPS location
how to know the location of the GPS in xbase
Nolberto Paulino
Regards

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: how to know the location of the GPS in xbase

#2 Post by Auge_Ohr »

digitsoft wrote:GPS location
how to know the location of the GPS in xbase
Google-View ?
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: how to know the location of the GPS in xbase

#3 Post by rdonnay »

Look at DC_MapDirections().
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: how to know the location of the GPS in xbase

#4 Post by Eugene Lutsenko »

Roger! That's cool!

Digitsoft! Position of what?

I had an idea to mark on the map the places of launches of the Eidos system, which I am developing. I realized that too. To do this, I started a host with support for ftp, php and java. It marked a php-script that determines the ip-address of the system startup and puts information about it in a text file on the host. Also in this text file are placed GEODATA about the location of the user, defined by ip-address.

Code: Select all

<?php 
    define("dvdr", ",");                                         // разделитель по умолчанию
    $logdate = date("d.m.Y,G:i:s");                              // дата, время
    $ip = getenv('HTTP_X_REAL_IP');                              // ip-адрес      Это работало (исходный вариант)
    if ( $ip == '' ) $ip = 'unknown';                            // проверяем, определился ли ip-адрес. Если не определился - пишем ip='unknown'

    // определяем регион, город и его геогр.координаты
    $var = file_get_contents('http://api.ipstack.com/' . $ip . '?access_key=*******************');

    // Распаковка строки
    $p1 = strpos ($var, "ip"          )+strlen("ip"          )+3;$p2 = strpos ($var, "type"        )-4;$var_ip_address   = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "country_code")+strlen("country_code")+3;$p2 = strpos ($var, "country_name")-4;$var_country_code = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "country_name")+strlen("country_name")+3;$p2 = strpos ($var, "region_code" )-4;$var_country_name = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "region_code" )+strlen("region_code" )+3;$p2 = strpos ($var, "region_name" )-4;$var_region_code  = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "region_name" )+strlen("region_name" )+3;$p2 = strpos ($var, "city"        )-4;$var_region_name  = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "city"        )+strlen("city"        )+3;$p2 = strpos ($var, "zip"         )-4;$var_city_name    = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "zip"         )+strlen("zip"         )+3;$p2 = strpos ($var, "latitude"    )-4;$var_zip          = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "latitude"    )+strlen("latitude"    )+2;$p2 = strpos ($var, "longitude"   )-3;$var_latitude     = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "longitude"   )+strlen("longitude"   )+2;$p2 = strpos ($var, "location"    )-3;$var_longitude    = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "geoname_id"  )+strlen("geoname_id"  )+2;$p2 = strpos ($var, "capital"     )-3;$var_geoname_id   = substr ($var, $p1, $p2-$p1+1);

    $varout1 = $var_ip_address.dvdr.$var_country_code.dvdr.$var_country_name.dvdr.$var_region_code.dvdr.$var_region_name.dvdr.$var_city_name;
    $varout2 = $var_zip.dvdr."Unknown".dvdr.$var_latitude.dvdr.$var_longitude.dvdr.$var_geoname_id;

    $log = $logdate . dvdr . $varout1 . dvdr . $varout2;                        // формируем строку

    $file = fopen("test_strings.txt","a+");                                     // пишем строку в файл
    fwrite($file,"$log \r\n");
    fclose($file);

//  print $log;
    echo '<meta http-equiv="refresh" content="0;URL=http://lc.kubagro.ru">';    // Редирект на основной сайт
?>
[/size]

Another php script (including java) visualizes this on the world map:

Code: Select all

<!DOCTYPE html>
<html>
<head>
<?php
$content = file_get_contents("test_strings.txt");
$content = explode("\r\n",$content);
foreach ($content as $key=>$record) {
	$content[$key] = explode(",", $record);
}

?>
<meta charset="utf-8">
<title>AIDOS map</title>
<link href="styles.css" rel="stylesheet" type="text/css">

<meta name="viewport" content="width=device-width, initial-scale = 1.0, user-scalable = no">
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
<script type="text/javascript">
    var aMap;
        
    ymaps.ready(function(){
        aMap = new ymaps.Map("main", {
            center: [29.00, 7.00],
            zoom: 3.3
        });
        aMap.container.fitToViewport();
		
		// Создаем геообъект с типом геометрии "Точка".
        gObj = new ymaps.GeoObject({
            // Описание геометрии.
            geometry: {
                type: "Point",
                coordinates: [<?=$content[0][10];?>, <?=$content[0][11];?>]
            },
            // Свойства.
            properties: {
                // Контент метки.
                // iconContent: '<?=$content[0][0].", ".$content[0][1];?>',
                // hintContent: '<?=$content[0][2];?>'
				hintContent: '<?=$content[0][0].", ".$content[0][1];?>: <?=$content[0][2];?>'
            }
        }, {
            // Опции.
            // Иконка метки будет растягиваться под размер ее содержимого.
            // preset: 'islands#blackStretchyIcon',
			preset: 'islands#icon',
        });
		aMap.geoObjects
        .add(gObj)
		<?php
			for ($i = 1; $i<count($content);$i++){
				echo ".add(new ymaps.Placemark([" . $content[$i][10].",".$content[$i][11]."], {";
				//echo " iconContent: '".$content[$i][0].", ".$content[$i][1]."',";
				//echo " hintContent: '".$content[$i][2]."'}, {  preset: 'islands#blackStretchyIcon' }))";
				//echo " iconContent: '".$content[$i][0].", ".$content[$i][1]."',";
				echo " hintContent: '" . $content[$i][0].", ".$content[$i][1]. ": ".$content[$i][2]."'}, 
						{  preset: 'islands#icon' }))";
			
			}
		
		?>
	
	});
	
</script>
</head>
<body>
<div id="wrapper">
	<div id="main">
		
	
	</div>

</div>


<script>
 
</script>
</body>
</html>
[/size]
The result is a display of the launch sites of the Eidos system on the world map: http://aidos.byethost5.com/map3.php
The Eidos system reads via ftp from my site a text database with ip addresses and other information about users, converts it to dbf, forms the necessary database for visualization and writes it via ftp to the site, and then runs php visualizing the world map. The actual source code of the system is on my website: http://lc.kubagro.ru/__AIDOS-X.txt. In the system Eidos, all this makes the F6_9(). The text file with information about the launches is named: "map_strings.txt"

On the system Eidos is written here: http://lc.kubagro.ru/aidos/Presentation ... online.pdf
You can Download it installation here: http://lc.kubagro.ru/aidos/_Aidos-X.htm

User avatar
digitsoft
Posts: 461
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: how to know the location of the GPS in xbase

#5 Post by digitsoft »

Hello Eugene
Have an example with eXpress that can see how to do it.
Thank you.
Eugene Lutsenko wrote:Roger! That's cool!

Digitsoft! Position of what?

I had an idea to mark on the map the places of launches of the Eidos system, which I am developing. I realized that too. To do this, I started a host with support for ftp, php and java. It marked a php-script that determines the ip-address of the system startup and puts information about it in a text file on the host. Also in this text file are placed GEODATA about the location of the user, defined by ip-address.

Code: Select all

<?php 
    define("dvdr", ",");                                         // разделитель по умолчанию
    $logdate = date("d.m.Y,G:i:s");                              // дата, время
    $ip = getenv('HTTP_X_REAL_IP');                              // ip-адрес      Это работало (исходный вариант)
    if ( $ip == '' ) $ip = 'unknown';                            // проверяем, определился ли ip-адрес. Если не определился - пишем ip='unknown'

    // определяем регион, город и его геогр.координаты
    $var = file_get_contents('http://api.ipstack.com/' . $ip . '?access_key=*******************');

    // Распаковка строки
    $p1 = strpos ($var, "ip"          )+strlen("ip"          )+3;$p2 = strpos ($var, "type"        )-4;$var_ip_address   = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "country_code")+strlen("country_code")+3;$p2 = strpos ($var, "country_name")-4;$var_country_code = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "country_name")+strlen("country_name")+3;$p2 = strpos ($var, "region_code" )-4;$var_country_name = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "region_code" )+strlen("region_code" )+3;$p2 = strpos ($var, "region_name" )-4;$var_region_code  = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "region_name" )+strlen("region_name" )+3;$p2 = strpos ($var, "city"        )-4;$var_region_name  = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "city"        )+strlen("city"        )+3;$p2 = strpos ($var, "zip"         )-4;$var_city_name    = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "zip"         )+strlen("zip"         )+3;$p2 = strpos ($var, "latitude"    )-4;$var_zip          = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "latitude"    )+strlen("latitude"    )+2;$p2 = strpos ($var, "longitude"   )-3;$var_latitude     = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "longitude"   )+strlen("longitude"   )+2;$p2 = strpos ($var, "location"    )-3;$var_longitude    = substr ($var, $p1, $p2-$p1+1);
    $p1 = strpos ($var, "geoname_id"  )+strlen("geoname_id"  )+2;$p2 = strpos ($var, "capital"     )-3;$var_geoname_id   = substr ($var, $p1, $p2-$p1+1);

    $varout1 = $var_ip_address.dvdr.$var_country_code.dvdr.$var_country_name.dvdr.$var_region_code.dvdr.$var_region_name.dvdr.$var_city_name;
    $varout2 = $var_zip.dvdr."Unknown".dvdr.$var_latitude.dvdr.$var_longitude.dvdr.$var_geoname_id;

    $log = $logdate . dvdr . $varout1 . dvdr . $varout2;                        // формируем строку

    $file = fopen("test_strings.txt","a+");                                     // пишем строку в файл
    fwrite($file,"$log \r\n");
    fclose($file);

//  print $log;
    echo '<meta http-equiv="refresh" content="0;URL=http://lc.kubagro.ru">';    // Редирект на основной сайт
?>
[/size]

Another php script (including java) visualizes this on the world map:

Code: Select all

<!DOCTYPE html>
<html>
<head>
<?php
$content = file_get_contents("test_strings.txt");
$content = explode("\r\n",$content);
foreach ($content as $key=>$record) {
	$content[$key] = explode(",", $record);
}

?>
<meta charset="utf-8">
<title>AIDOS map</title>
<link href="styles.css" rel="stylesheet" type="text/css">

<meta name="viewport" content="width=device-width, initial-scale = 1.0, user-scalable = no">
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
<script type="text/javascript">
    var aMap;
        
    ymaps.ready(function(){
        aMap = new ymaps.Map("main", {
            center: [29.00, 7.00],
            zoom: 3.3
        });
        aMap.container.fitToViewport();
		
		// Создаем геообъект с типом геометрии "Точка".
        gObj = new ymaps.GeoObject({
            // Описание геометрии.
            geometry: {
                type: "Point",
                coordinates: [<?=$content[0][10];?>, <?=$content[0][11];?>]
            },
            // Свойства.
            properties: {
                // Контент метки.
                // iconContent: '<?=$content[0][0].", ".$content[0][1];?>',
                // hintContent: '<?=$content[0][2];?>'
				hintContent: '<?=$content[0][0].", ".$content[0][1];?>: <?=$content[0][2];?>'
            }
        }, {
            // Опции.
            // Иконка метки будет растягиваться под размер ее содержимого.
            // preset: 'islands#blackStretchyIcon',
			preset: 'islands#icon',
        });
		aMap.geoObjects
        .add(gObj)
		<?php
			for ($i = 1; $i<count($content);$i++){
				echo ".add(new ymaps.Placemark([" . $content[$i][10].",".$content[$i][11]."], {";
				//echo " iconContent: '".$content[$i][0].", ".$content[$i][1]."',";
				//echo " hintContent: '".$content[$i][2]."'}, {  preset: 'islands#blackStretchyIcon' }))";
				//echo " iconContent: '".$content[$i][0].", ".$content[$i][1]."',";
				echo " hintContent: '" . $content[$i][0].", ".$content[$i][1]. ": ".$content[$i][2]."'}, 
						{  preset: 'islands#icon' }))";
			
			}
		
		?>
	
	});
	
</script>
</head>
<body>
<div id="wrapper">
	<div id="main">
		
	
	</div>

</div>


<script>
 
</script>
</body>
</html>
[/size]
The result is a display of the launch sites of the Eidos system on the world map: http://aidos.byethost5.com/map3.php
The Eidos system reads via ftp from my site a text database with ip addresses and other information about users, converts it to dbf, forms the necessary database for visualization and writes it via ftp to the site, and then runs php visualizing the world map. The actual source code of the system is on my website: http://lc.kubagro.ru/__AIDOS-X.txt. In the system Eidos, all this makes the F6_9(). The text file with information about the launches is named: "map_strings.txt"

On the system Eidos is written here: http://lc.kubagro.ru/aidos/Presentation ... online.pdf
You can Download it installation here: http://lc.kubagro.ru/aidos/_Aidos-X.htm
Nolberto Paulino
Regards

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: how to know the location of the GPS in xbase

#6 Post by Eugene Lutsenko »

Digitsoft! I saw the example of Roger: DC_MapDirections(). I really enjoyed it. Totally cool! But I don't know if this example does what I need. When I did that, I didn't know about the Alaska possibilities at all.

User avatar
digitsoft
Posts: 461
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: how to know the location of the GPS in xbase

#7 Post by digitsoft »

hello Roger
Very Good Work the one that made with DC_MapDirections

But I need to know the position where I am, a function that gives me the data where I am and then see it with your DC_MapDirections that is excellent.
rdonnay wrote:Look at DC_MapDirections().
Nolberto Paulino
Regards

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: how to know the location of the GPS in xbase

#8 Post by rdonnay »

But I need to know the position where I am
So are you saying that you need to get the GPS coordinates of the computer that is running an Xbase++ program?
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: how to know the location of the GPS in xbase

#9 Post by Auge_Ohr »

digitsoft wrote:But I need to know the position where I am, a function that gives me the data where I am
do you have Street Name :?:
Google-View does give you GPS Position when ask "what here".

else you need a GPS-Tacker which can send Data (via Bluetooth) to App.
GPS_Tracker.JPG
GPS_Tracker.JPG (77.86 KiB) Viewed 15274 times
i can receive Data in Mappoint which i can control via activeX from Xbase++.

---

Table PC most have GPS build-in but you need .Net to access those Device.
have not found 3PP yet which can be used.
greetings by OHR
Jimmy

User avatar
digitsoft
Posts: 461
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: how to know the location of the GPS in xbase

#10 Post by digitsoft »

Exact
rdonnay wrote:
But I need to know the position where I am
So are you saying that you need to get the GPS coordinates of the computer that is running an Xbase++ program?
Nolberto Paulino
Regards

Post Reply