Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 8 of 8

MapPoint 2004 (Desktop version) and Web application

This is a discussion on MapPoint 2004 (Desktop version) and Web application within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hy, I'm newbie on MapPoint 2004 and i'm actually working on a sharepoint portal, so i would develop a webpart ...

  1. #1
    William is offline Junior Member White Belt
    Join Date
    Mar 2006
    Posts
    3

    MapPoint 2004 (Desktop version) and Web application

    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 &#58; System.Web.UI.Page
    	&#123;
    		protected System.Web.UI.WebControls.TextBox TextBox1;
    		//protected MapPoint.Map MaCarte;
    	
    		ApplicationClass _appMapPoint;
    
    		private void Page_Load&#40;object sender, System.EventArgs e&#41;
    		&#123;
    			// Placer ici le code utilisateur pour initialiser la page
    			ChargerDonnees&#40;&#41;;
    		&#125;
    
    		private void ChargerDonnees&#40;&#41;
    		&#123;
    			
    			
    			Location _location = null;
    			Map _map = null;
    			FindResults _frs = null;
    
    			MapPoint.DataSet _dataset;
    			MapPoint.DataMap _datamap;
    			MapPoint.Field _field;
    			
    			try
    			&#123;
    				// get the location
    				_appMapPoint = new ApplicationClass&#40;&#41;;
    				// Now get the location
    				_frs = _appMapPoint.ActiveMap.FindResults&#40;"Paris"&#41;;
    				// Check if the find query is successfull
    				if&#40;_frs != null && _frs.Count > 0&#41;
    				&#123;
    					object index = 1;
    					_location = _frs.get_Item&#40;ref index&#41; 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&#40;GeoCountry.geoCountryFrance&#41;;
    					object _index_demographic="2002_Population &#40;totale&#41;";
    					_field = _dataset.Fields.get_Item&#40;ref _index_demographic&#41;;
    
    					//Define ranges
    
    					object&#91;&#93; myranges = new object&#91;3&#93; &#123;0,65000, 130000&#125;;
    
    					//Define range labels
    
    					object&#91;&#93; mylabels = new object&#91;3&#93; &#123;"Low", "Medium", "High"&#125;;
    
    					_datamap = _dataset.DisplayDataMap&#40;GeoDataMapType.geoDataMapTypeShadedArea, _field,GeoShowDataBy.geoShowByDefault, GeoCombineDataBy.geoCombineByDefault, GeoDataRangeType.geoRangeTypeDiscreteLogRanges, GeoDataRangeOrder.geoRangeOrderDefault, 15, 3, myranges, mylabels, missing, missing, missing&#41;;
    					_datamap.LegendTitle = "My first map ...";
    					_appMapPoint.Visible = true;
    					_appMapPoint.UserControl =true;
    
    
    				&#125;
    			&#125;
    			catch &#40;Exception ex&#41;
    			&#123;
    				string _strMessage = ex.Message + " " +ex.Source +ex.InnerException +ex.StackTrace;
    				
    				TextBox1.Text = _strMessage;
    			&#125;
    			finally
    			&#123;
    				if&#40;_appMapPoint!=null&#41;
    				&#123;
    					try
    					&#123;
    						_appMapPoint.Quit&#40;&#41;;
    					&#125;
    					catch
    					&#123;
    					&#125;
    					finally
    					&#123;
    						_dataset = null;
    						_datamap = null;
    						_field = null;
    						_location = null;
    						 _map = null;
    						_frs = null;
    						_appMapPoint =null;
    					&#125;
    				&#125;
    			&#125;
    
    		&#125;
    
    		#region Code généré par le Concepteur Web Form
    		override protected void OnInit&#40;EventArgs e&#41;
    		&#123;
    			//
    			// CODEGEN &#58; Cet appel est requis par le Concepteur Web Form ASP.NET.
    			//
    			InitializeComponent&#40;&#41;;
    			base.OnInit&#40;e&#41;;
    		&#125;
    		
    		/// <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&#40;&#41;
    		&#123;    
    			this.Load += new System.EventHandler&#40;this.Page_Load&#41;;
    
    		&#125;
    		#endregion
    	&#125;
    
    &#125;
    William

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Did you also try in a regular Winform ? maybe the webform give the problem?

  3. #3
    michele is offline Junior Member Yellow Belt
    Join Date
    Oct 2005
    Posts
    13
    I use MapPoint 2004 to generate maps as gifs (with save as web page), then I display the gif in the webform.

    I catch client script events such as click on map, drag and so on and I command MapPoint 2004 to zoom in that point etc.

    MapPoint 2004 runs under a Window Services I created (I don't like using ocx, com objects under IIS) and i communicate from webform and window services by Sockets.

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    But I repeat my question:
    - did you try in a regular winform ?
    - did you try in a normal application ?
    If you dont then we cannot dscover where the problem is.

  5. #5
    William is offline Junior Member White Belt
    Join Date
    Mar 2006
    Posts
    3
    Hey,

    Sorry Wilfried for the delay.

    I don't try in a regular winform because i want to display MapPoint maps in a web application (in sharepoint) so i think i can just create webforms not winforms.

    I'm not very experimented with web application but i think it's not possible to display a winform in a web application. If it is possible, it's probably the solution but i don't know.

    thanx for your interest for my problem.
    William

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Impossible to find solution withoud first try to find out where the problem is

  7. #7
    William is offline Junior Member White Belt
    Join Date
    Mar 2006
    Posts
    3
    Ok Wilfried.
    I will try to display a map on a winform. I think it will be more easer because i will be able tu use the MapPoint of activeX control.

    Michele, could you give some example of javascript of your solution ? With your solution can you know where the user click on the generated map (for example, on a particular city) ?

    Thanx
    William

  8. #8
    michele is offline Junior Member Yellow Belt
    Join Date
    Oct 2005
    Posts
    13
    Quote Originally Posted by William
    Ok Wilfried.
    I will try to display a map on a winform. I think it will be more easer because i will be able tu use the MapPoint of activeX control.

    Michele, could you give some example of javascript of your solution ? With your solution can you know where the user click on the generated map (for example, on a particular city) ?

    Thanx
    This is not a complete code but I hope it can be useful for your needs.

    This is the tag for the image map
    <asp:image onmouseup="EndDrag(event);" onmousemove="Dragging(event);" onmousedown="StartDrag(event);"
    id="imgMap" ondrag="window.event.returnValue = false;window.event.cancelBubble = true;"
    style="Z-INDEX: 128; LEFT: 0px; POSITION: relative; TOP: 0px; dislay: none" onclick="ClickOnMap(event);"
    BorderColor="Transparent" Runat="server" src="" alt="" width="686" height="566"></asp:image>

    This is the javascript function ClickOnMap()

    function ClickOnMap(e){
    ...
    x = document.body.scrollLeft + e.clientX;
    y = document.body.scrollTop + e.clientY;

    hidXMap and hidYMap are hidden text field
    Form1.hidXMap = x;
    Form1.hidYMap = y;
    //You submit the page, so Form1_PageLoad() server script will be fired
    Form1.submit();
    //Now I use Ajax technology to avoid entire page refresh instead of Form1.submit(), but for the example I miss it.

    }

    You must implement zoomout and pan too.

    Server side code (c#)

    void Page_Load(){

    //hidCurrMethod is a hidden text box that stores the current method selected by the user (you can use checkbox like chkZoomIn, chkZoomOut and so on to set the value)
    if (hidCurrMethod.value == 'ZoomIn'){

    Pan(X,Y);
    MapPointObject.ActiveMap.ZoomIn();
    MapPoinObject.ActiveMap.SavedWebPages.Add(GifName) ;
    //Now I set the image in the browser as the new map
    imgMap.src = GifName;



    }


    }




    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. mappoint 2004 new version 2006?
    By delfo in forum MapPoint Desktop Discussion
    Replies: 9
    Last Post: 11-03-2005, 10:44 AM
  2. Distributed desktop application
    By emale00 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-20-2005, 01:55 PM
  3. custom vb.net application using mappoint 2004
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 10-19-2004, 01:37 PM
  4. Is MapPoint 2004 Euro version available yet?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 09-19-2003, 10:30 AM
  5. MapPoint 2004 European Version
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-24-2003, 11:30 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27