View Full Version : Programatically plot a route based on GPS position

12-12-2005, 03:58 PM
Using the mappoint OCX want to route based on current GPS position and a given address. In fact, if I could show the current position based on GPS coordinates on the map that would be swell too. I am using the OCX so this must be done programatically. Any suggestions?

12-13-2005, 12:45 PM

You receive position then place a pushpin on the map like following example:

Location loc = mp.ActiveMap.GetLocation(lat, lon, 1);
Pushpin pp = mp.ActiveMap.AddPushpin(loc, vehicleName);
pp.Symbol = 1;

Eventually you add note:

pp.Note = vehicleName + otherInfo;

Eventually you change ballonstate:

PP.BalloonState = GeoBalloonState.geoDisplayName;
pp.BalloonState = GeoBalloonState.geoDisplayBalloon;
pp.Highlight = true;

Eventually you zoom to vehicle with one of following:

mp.ActiveMap.GoToLatLong(lat, lon, alt);

12-13-2005, 12:47 PM
The question is, how do I receive position?

12-13-2005, 12:54 PM

This is fast reply :)

I dont really understeand. You can programmaticly put positions on map. You receive postion can in various ways, but this is enterly depending on your application.

For example if you want to have a dispatch centre with whole fleet, then you must write a server getting all positions of the fleet. This can be done with GSM's or with boardcomputers, etc. There are GSM that can send a GPS position.

Some GSM providers (not all) also have a service to give the position of it. That's what mappoint location server make use off. But not all GSM providers have that service.

Please tell me some more of your application so that we able to help more.

12-13-2005, 01:04 PM
Okay sorry what I am wondernig is how am I going to get the current lattitude and longitude out of my GPS receiver. BTW, I am using the Pharos BT GPS Rx.

My application is very simple, I only want to be able to plot a route based on one's current GPS position to a given address.

Does that make sense?

12-14-2005, 02:10 PM

I cannot give code example because I do not have PC based application to get positions out of GPS receiver.

But it is very simple. Program your GPS receiver to give GGA or RMC strings, just parse it and give the coordinates to mappoint.