Hy,
I'm newbie on MapPoint 2004 and i'm actually working on a sharepoint portal, so i would develop a webpart to display Business informations on a mapPoint map according to informations entered by users.
My simple question is, it is possible to display a dynamic map (we want users have the possibility, for example, to select a pushpin on the map) in a web page with the mappoint 2004 desktop version (not the web services version).
Is it possible and how ?
I have tried many things with the MapPoint 2004 object model without success. I post my code (in c# in visual studio 2003) and i hope somebody will can help me.
Any response will be appreciated
In my project, i have referenced the MapPoint COM library : Microsoft MapPoint 11.0 Object Library (Europe).
Below, the code of my webform (this code returns an error on the DisplayDataMap Method : incorrect parameter) :
Code:using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using MapPoint; namespace Mappoint { /// <summary> /// Description résumée de WebForm1. /// </summary> public class WebForm1 : System.Web.UI.Page { protected System.Web.UI.WebControls.TextBox TextBox1; //protected MapPoint.Map MaCarte; ApplicationClass _appMapPoint; private void Page_Load(object sender, System.EventArgs e) { // Placer ici le code utilisateur pour initialiser la page ChargerDonnees(); } private void ChargerDonnees() { Location _location = null; Map _map = null; FindResults _frs = null; MapPoint.DataSet _dataset; MapPoint.DataMap _datamap; MapPoint.Field _field; try { // get the location _appMapPoint = new ApplicationClass(); // Now get the location _frs = _appMapPoint.ActiveMap.FindResults("Paris"); // Check if the find query is successfull if(_frs != null && _frs.Count > 0) { object index = 1; _location = _frs.get_Item(ref index) as Location; _appMapPoint.Visible = true; _appMapPoint.UserControl = true; // pour les paramètres facultatifs object missing = System.Reflection.Missing.Value; _map = _appMapPoint.ActiveMap; _dataset = _map.DataSets.GetDemographics(GeoCountry.geoCountryFrance); object _index_demographic="2002_Population (totale)"; _field = _dataset.Fields.get_Item(ref _index_demographic); //Define ranges object[] myranges = new object[3] {0,65000, 130000}; //Define range labels object[] mylabels = new object[3] {"Low", "Medium", "High"}; _datamap = _dataset.DisplayDataMap(GeoDataMapType.geoDataMapTypeShadedArea, _field,GeoShowDataBy.geoShowByDefault, GeoCombineDataBy.geoCombineByDefault, GeoDataRangeType.geoRangeTypeDiscreteLogRanges, GeoDataRangeOrder.geoRangeOrderDefault, 15, 3, myranges, mylabels, missing, missing, missing); _datamap.LegendTitle = "My first map ..."; _appMapPoint.Visible = true; _appMapPoint.UserControl =true; } } catch (Exception ex) { string _strMessage = ex.Message + " " +ex.Source +ex.InnerException +ex.StackTrace; TextBox1.Text = _strMessage; } finally { if(_appMapPoint!=null) { try { _appMapPoint.Quit(); } catch { } finally { _dataset = null; _datamap = null; _field = null; _location = null; _map = null; _frs = null; _appMapPoint =null; } } } } #region Code généré par le Concepteur Web Form override protected void OnInit(EventArgs e) { // // CODEGEN : Cet appel est requis par le Concepteur Web Form ASP.NET. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas /// le contenu de cette méthode avec l'éditeur de code. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } }