|
|
|
date: Sat, 19 Apr 2008 17:06:00 -0700,
group: microsoft.public.mappoint.webservice
back
help me pls
I am getting system cant find the specified file :GetDistance and i am using
the trial version of mappoint and below is my code . thanks in advance.
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using MapPointApp;
using System.Configuration;
namespace MPDMService
{
class MappointUtils
{
static string objTemplate = "NAMAP.ptt";
public MapPointApp.Application mapApp = null;
//public static MapPointApp.Application mapApp = null;
// causes multiple instances to be not released properly
static MapPointApp.Map oMap = null;
public MappointUtils()
{
try
{
mapApp = new MapPointApp.ApplicationClass();
// oMap = mapApp.NewMap("C:\\" + objTemplate);
oMap = mapApp.NewMap("C:\\NAMAP.ptt");
// oMap = mapApp.NewMap(NAMAP.ptt);
}
catch (Exception ex)
{
throw ex;
}
}
public double CalculateMilesPart1(Address addr1,
Address addr2)
{
object key = 1;
double value = 0;
try
{
MapPointApp.Location objLoc1 = null;
MapPointApp.Location objLoc2 = null;
MapPointApp.FindResults res = null;
MapPointApp.Route aroute1 = null;
aroute1 = oMap.ActiveRoute;
aroute1.Clear();
res = oMap.FindAddressResults(addr1.StreetAddress,
addr1.City, "", addr1.State, addr1.Zip, addr1.Country);
objLoc1 = (MapPointApp.Location)res.get_Item(ref key);
res = oMap.FindAddressResults(addr2.StreetAddress,
addr2.City, "", addr2.State, addr2.Zip, addr2.Country);
objLoc2 = (MapPointApp.Location)res.get_Item(ref key);
aroute1.Waypoints.Add(objLoc1, "");
aroute1.Waypoints.Add(objLoc2, "");
aroute1.Calculate();
value = aroute1.Distance;
oMap.Saved = true;
}
catch (Exception ex)
{
throw ex;
}
return value;
}
}
}
date: Sat, 19 Apr 2008 17:06:00 -0700
author: Mayur
|
|