MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




MapPoint 2004 (Desktop version) and Web application

This is a discussion on MapPoint 2004 (Desktop version) and Web application within the MapPoint 2006/2009 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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-14-2006
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 : 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
	}

}
__________________
William
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 03-14-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi,

Did you also try in a regular Winform ? maybe the webform give the problem?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 03-21-2006
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 03-21-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 03-22-2006
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 03-22-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi,

Impossible to find solution withoud first try to find out where the problem is
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 03-23-2006
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 03-24-2006
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;



}


}




}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
application, desktop, mappoint 2004, version, web


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 03:01 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54