View Single Post

  #10 (permalink)  
Old 01-07-2005
Wilfried Wilfried is offline
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,123
Hi,

This is VB code for geocoding:
http://www.mp2kmag.com/articles.asp?...xtract.lat.lon
This is the same one converted into C#:
http://www.mp2kmag.com/mappoint/disc...pic.asp?t=3291

I have something similar in Delphi5 but cant find it at the moment.

What you have to do is first get a Location object form the address information you get. Something similar like this:

Code:
            FindResults AddrResults = MP.ActiveMap.FindAddressResults(street, city, othercity, region, zip, country);

            foreach (object o in AddrResults) {
                Location Loc = o as Location;

                if (Loc != null) {
                    double Lat;
                    double Lon;
                    pos.CalcPos(Loc, out Lat, out Lon);
                    Console.WriteLine(Loc.Name + " " + Lat.ToString() + " " + Lon.ToString());
                }
The pos.CalcPos is the geocoding function described in the both URL's. Once you have the position of all the points you can calculate the route. But I will this post a litte later today as I have to go now...
Reply With Quote