User avatar
johan
GpsGate
Posts: 14072
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

Show GpsGate.com positions in real time on map

Mon Jan 29, 2007 11:26 pm

GpsTools + GpsGate.com

If you don't use GpsTools, but still want to integrate your application to GpsGate.com, please read this protocol specifications
here.

Show position data from GpsGate.com in your GpsTools application
This guide will show you how to display a set of user (buddies) from GpsGate.com
in real time on your GpsTools map.


1. Introduction

Using GpsGate.com SDK + GpsTools you can easily show positions fetched from GpsGate.com on a
GpsTools map. You can only get positions from users that are in your buddy list.

<img src="guide/0008_gpsgatecom_gpstools.gif" width=250 height=220>


2. Getting everything in place


1. Create an account by <a href="http://GpsGate.com" target="_blank">GpsGate.com</a>
2. Download and install <a href="http://franson.com/gpstools" target="_blank">GpsTools SDK</a>
3. Download and install <a href="http://franson.com/gpsgateserver" target="_blank">GpsGate.com SDK</a>
4. Open the "SimpleMap" or "MultiMap" sample and make the changes you find below. You need to make a reference to "GpsGate.Client.dll" found in GpsGate.com SDK


3. The code


<table bgcolor="#fbedbb" width="100%">
<tr>
<td>
<pre>
using GpsGate.Client;

private GpsGateClient m_client = null;
private ListDictionary m_listPosition = new ListDictionary();

public delegate void UpdateDelegate();

void ConnectToGpsGateCom()
{
// GpsGate.com server
m_client = new GpsGateClient("online.gpsgate.com", 30175);

// Events
m_client.TrackPointReceived += new GpsGateClient.TrackPointReceivedHandle(m_client_TrackPointReceived);
m_client.Disconnected += new GpsGateClient.DisconnectdHandle(m_client_Disconnected);

// Connect (create account on GpsGate.com)
m_client.Connect("username", "password");

// Start receiving data for buddy list. Max speed of 5 second intervals
m_client.RequestBuddyListTrackPoints(5);
}

void m_client_TrackPointReceived(GpsGateClient client, Franson.Geo.TrackPoint trackPoint, string strUsername)
{
// Will be called when any user in your buddy list updates his position

// NOTE! This method is called in a new thread!
// If shared data is used Invoike() or lock() must be used to make
// sure we don't get any threading errors!

// See if we have a position stored for this username
GpsToolsNET.Position posTools = (GpsToolsNET.Position) m_listPosition[strUsername];

if (posTools == null)
{
posTools = new GpsToolsNET.Position();
// Keep it in list. Updating those positions will later move objects on map
m_listPosition.Add(strUsername, posTools);

// Create a label which we position
GpsViewNET.Label labelUser = map1.NewLabel();

labelUser.Text = strUsername;
labelUser.Brush.Transparent = false;
labelUser.Position = posTools;
}

// GpsGate.Client.Position are not the same as GpsToolsNET.Position
// We need to copy the lon/lat info
posTools.Longitude = trackPoint.Position.Longitude;
posTools.Latitude = trackPoint.Position.Latitude;

// Map.Update() must be called in GUI thread.
Invoke(new UpdateDelegate(m_Update));
}

void m_Update()
{
// Called in GUI thread
map1.Update();
}
</pre>
</td>
</tr>
</table>

totoro_lp
Posts: 4
Joined: Thu Sep 13, 2007 11:25 am

RE: Show GpsGate.com positions in real time on map

Mon Sep 17, 2007 9:57 am

Hi,

I am having some problems with the codes. I have added "GpsGate.Client". But I still have errors like "GpsViewNET.Map" is not defined" etc.

Can someone advise me?

User avatar
johan
GpsGate
Posts: 14072
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: Show GpsGate.com positions in real time on map

Mon Sep 17, 2007 12:17 pm

The sample above requires GpsTools SDK as well:
http://franson.com/gpstools

Note that you don't need GpsTools SDK to send data, it is only used to display the map in the sample above.

Regards,
Johan

Franson Support

totoro_lp
Posts: 4
Joined: Thu Sep 13, 2007 11:25 am

RE: Show GpsGate.com positions in real time on map

Mon Sep 17, 2007 2:23 pm

Hi,

I have successful run "SimpleMap" on my desktop which has no GPS receiver. Now I would like to test "SimpleMap" in my PPC. How can I do it?

Regards,

User avatar
johan
GpsGate
Posts: 14072
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: Show GpsGate.com positions in real time on map

Mon Sep 17, 2007 2:42 pm

Well, you create a project for Pocket PC, include the assemblies for Pocket PC and so on. It is the exact same thing, only that you do a Pocket PC project.

Regards,
Johan

Franson Support

totoro_lp
Posts: 4
Joined: Thu Sep 13, 2007 11:25 am

RE: Show GpsGate.com positions in real time on map

Tue Sep 18, 2007 1:11 pm

Where do i add the given codes?

zeeshanprojects
Posts: 29
Joined: Tue Nov 13, 2007 12:38 pm
Location: Pakistan

RE: Show GpsGate.com positions in real time on map

Wed Mar 12, 2008 12:55 pm

this line gives an error "private ListDictionary m_listPosition = new ListDictionary();"
"ListDictionary" doest not contain any object under any class/library.

zeeshanprojects
Posts: 29
Joined: Tue Nov 13, 2007 12:38 pm
Location: Pakistan

RE: Show GpsGate.com positions in real time on map

Wed Mar 12, 2008 3:23 pm

Can U send this whole C sharp code in VB.NET. some of the things difficult to convert

Return to “GpsTools”