Community of MapPoint and Virtual Earth Users and Developers
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 ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| MapPoint 2004 (Desktop version) and Web application 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 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 |
| |||
|
Hi, Did you also try in a regular Winform ? maybe the webform give the problem?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
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. |
| |||
|
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.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
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 |
| |||
|
Hi, Impossible to find solution withoud first try to find out where the problem is
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
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 |
| |||
| Quote:
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; } } } |
![]() |
| Tags |
| application, desktop, mappoint 2004, version, web |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| mappoint 2004 new version 2006? | delfo | MapPoint 2006/2009 Discussion | 9 | 11-03-2005 09:44 AM |
| Distributed desktop application | emale00 | MapPoint 2006/2009 Discussion | 1 | 09-20-2005 12:55 PM |
| custom vb.net application using mappoint 2004 | Anonymous | MapPoint 2006/2009 Discussion | 3 | 10-19-2004 12:37 PM |
| Is MapPoint 2004 Euro version available yet? | Anonymous | MapPoint 2006/2009 Discussion | 2 | 09-19-2003 09:30 AM |
| MapPoint 2004 European Version | Anonymous | MapPoint 2006/2009 Discussion | 1 | 08-24-2003 10:30 PM |
Thassos Holidays
Visit an unspoilt and beautiful Greek island with Thassos holidays available through UlookUbook.