MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




A simple map with a pushpin on click

This is a discussion on A simple map with a pushpin on click within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I just want a simple map on a web page that, when the user clicks on it, the map displays ...


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 10-12-2005
Junior Member
White Belt
 
Join Date: Oct 2005
Posts: 1
A simple map with a pushpin on click

I just want a simple map on a web page that, when the user clicks on it, the map displays again with a pushpin in the click location. But, I have a problem that I just can't seem to get around.

I build a map and place it in a webcontrols image button. On the click event I calculate the latlong and set a pushpin. This all works fine until the map is zoomed or panned and then a subseqeunt map click places the pushpin in the wrong location.

Any help would be much appreciated!

Here is the click event code...

PixelCoord myPixelCoords = new PixelCoord();
myPixelCoords.X = e.X;
myPixelCoords.Y = e.Y;
RenderMap(0, 0, 0, myPixelCoords);

Here is the RenderMap code... (right out of the sample but with a pushpin)

void RenderMap(double myPanHorizontalAdjustment, double
myPanVerticalAdjustment, double myZoomValue, PixelCoord PushPinCoord)
{
MapWithNavigationButtonsCS.Global global =
(MapWithNavigationButtonsCS.Global)Context.Applica tionInstance;

//Get the latest map specification object
MapSpecification mapSpec = (MapSpecification)Cache["myMapSpec"];

//Pan or zoom the map as appropriate
mapSpec.Options.PanHorizontal = mapSpec.Options.PanHorizontal +
myPanHorizontalAdjustment;
mapSpec.Options.PanVertical = mapSpec.Options.PanVertical +
myPanVerticalAdjustment;

if (!(mapSpec.Options.Zoom + myZoomValue <= 0))
{
mapSpec.Options.Zoom = mapSpec.Options.Zoom + myZoomValue;
}
if (PushPinCoord != null)
{
PixelCoord [] coordinates = {PushPinCoord};

LatLong[] centerCoords =
global.RenderService.ConvertToLatLong(coordinates ,mapSpec.Views[0],
500, 500);
Pushpin[] myPushPins = new Pushpin[1];
myPushPins[0] = new Pushpin();
myPushPins[0].PinID = "pin0";
myPushPins[0].IconName = "0";
myPushPins[0].IconDataSource = "MapPoint.Icons";
myPushPins[0].LatLong = new LatLong();
myPushPins[0].LatLong = centerCoords[0];
mapSpec.Pushpins = myPushPins;

}
//Declare the map image array and get the map
MapImage[] myMapImages;

try
{
myMapImages = global.RenderService.GetMap(mapSpec);
//Assign the Map Url
this.Map.ImageUrl = myMapImages[0].Url;

//Also restore the changed map specification
Cache["myMapSpec"] = mapSpec;
}
catch(SoapException myException)
{
}

}

Thanks in advance for the help!

Jay
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 10-13-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,105
Hi,

this is how you place the pushpin. It is places exacly where it is clicked:

Code:
            Location loc = mp.ActiveMap.XYToLocation(e.x, e.y);
            mp.ActiveMap.AddPushpin(loc, "");
e is the event arguments of the before click event handler.
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
click, map, pushpin, simple


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
Double Click on a Pushpin Anonymous MapPoint 2006/2009 Discussion 4 02-28-2004 06:26 PM
I need help with MP2K Directions, I have a simple app in VB6 NickSP MapPoint 2006/2009 Discussion 2 02-28-2003 03:41 PM
a simple question Anonymous MapPoint 2006/2009 Discussion 2 10-29-2002 10:53 AM
I am currently trying to develop a simple co-ordin.... Anonymous MapPoint 2006/2009 Discussion 1 08-07-2001 09:38 AM
I am looking at purchasing a simple GIS system to .... Anonymous MapPoint 2006/2009 Discussion 1 07-18-2001 05:57 AM


All times are GMT -5. The time now is 06:04 AM.


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

Ski Holidays France
Ski holidays in France are popular with both beginners and experienced skiers alike. It's easy to see why in light of the huge diversity of slopes and the numerous entertainment options.

Turkey Weather
Check out Turkey Weather - Travel Counsellors details information on Turkey including, weather, flights and accommodation.

Holiday to Thailand
Want to go somewhere new? Book a low cost holiday to Thailand at dealchecker.co.uk. See the stunning national parks and uninhabited islands.

Cuba Holidays
Cuba holidays offer an exciting cultural and wonderful culinary experience. Book with The Holiday Place for a great deal.

Cheap Balearics Holidays
Cheap Balearics holidays are available if you know when to book and who to book with. The Balearics have many fascinating places to visit all year round. The partying never stops.

Compare Prices
Travel.co.uk makes it easy for you to compare prices from hundreds of UK based travel companies.

Holidays to Lanzarote
Not been to the Canary Islands yet? What are you waiting for! Get information on holidays to Lanzarote at On The Beach.


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