MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Long/Lat from click.

This is a discussion on Long/Lat from click. within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I am working on a tracking system and mappoint is my mapping software. I am using VB for my programming. ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-28-2004
Junior Member
White Belt
 
Join Date: Oct 2004
Posts: 10
Send a message via MSN to Milo Send a message via Yahoo to Milo
Long/Lat from click.

I am working on a tracking system and mappoint is my mapping software. I am using VB for my programming. At the moment i am doing geofencing and what i want to do is be able to get the lats and longs of a location where i click on the map...is this possible? thanks
__________________
=========
Milo
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-28-2004
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Yes, here is alink to the article that will help you.

http://www.mp2kmag.com/articles.asp?ArticleID=13
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
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 10-28-2004
EdB EdB is offline
Member
Green Belt
 
Join Date: Aug 2002
Posts: 56
You know, I don't think that's the answer he's looking for, though I could be wrong. If I'm not, I'm looking for the same answer.

The article points to a routine that is well known around here for extracting the lat/long from a pushpin. But what if you are just trying to react to a users click of a spot on the map, similar to what the location tool does.....as you move about on the map it reports the lat/long.

The closest thing I can get to that involves the user having to place a pushpin at the desired location, then push a VB button.....which then executes the above.......as long as the user doesn't change the name of the pushpin.
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 10-28-2004
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Look at the MouseDown or MouseUp event

Quote:
X ByVal Long. The X coordinate of the mouse pointer relative to the map window, in pixels.
Y ByVal Long. The Y coordinate of the mouse pointer relative to the map window, in pixels
In that event you will get the x/y of the mouse.

Now take a look at the XYToLocation method. Use it to take the x/y of the mouse and get a location object. At this point you should have the required stuff to use the calcpos function to return the lat/lon.

Also, there is another article that uses the same concept in .net to demonstrate the location sensor (uses the mousemove event)
http://www.mp2kmag.com/a66--location....mappoint.html
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
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 10-28-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Where have you been all my life?

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 10-29-2004
Junior Member
White Belt
 
Join Date: Oct 2004
Posts: 10
Send a message via MSN to Milo Send a message via Yahoo to Milo
yeah this is what i have come to but i dont know how yo use the function calcpos. could you give an exapmle of how to use it? I keep getting an error, object variable or with block variable not set.

Regards,
__________________
=========
Milo
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 10-29-2004
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Ok, Let me know if this works for you.

Visual Basic 6
Assumes you have the CalcPos Sub and the Function Arccos by Author Gilles Kohl in you project. http://www.mp2kmag.com/articles.asp?ArticleID=13
References: Microsoft MapPoint 11.0 Object Library(North America)
MapPointControl.ocx is on Form1
One Command Button (Command1)


Code:
Public ilat As Double
Public ilon As Double

Private Sub Form_Load()
Dim objmap As MapPointctl.Map
Set objmap = MappointControl1.NewMap(geoMapNorthAmerica)
End Sub


Private Sub Command1_Click()
Dim objmap As MapPointctl.Map
Set objmap = MappointControl1.ActiveMap
Dim objLoc As MapPointctl.Location
Dim objPushpin As MapPointctl.Pushpin
Set objLoc = objmap.FindResults("Seattle, WA")(1)
Set objPushpin = objmap.AddPushpin(objLoc, "My Test Pushpin")
CalcPos objmap, objPushpin.Location, ilat, ilon
MsgBox ilat & ", " & ilon
End Sub
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
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 10-29-2004
Junior Member
White Belt
 
Join Date: Oct 2004
Posts: 10
Send a message via MSN to Milo Send a message via Yahoo to Milo
excellent!! the only problem is, is sometimes i'm getting "The parameter is incorrect" Does this work all over the world?
__________________
=========
Milo
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


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
Where did I click on that line? Jumbly MapPoint 2006/2009 Discussion 3 12-08-2004 03:53 AM
How to add click event for VB.Net ? Anonymous MapPoint 2006/2009 Discussion 2 12-31-2003 12:15 AM
Double Click on map Anonymous MapPoint 2006/2009 Discussion 0 08-08-2003 06:42 PM
Mouse Click on legend Anonymous MapPoint 2006/2009 Discussion 0 07-10-2003 05:39 PM
What happens when YOU click on a street? schuchhardp MapPoint 2006/2009 Discussion 5 01-03-2003 10:37 AM


All times are GMT -5. The time now is 09:18 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

Cheap flights to Athens
Book cheap flights to Athens on Holiday Hypermarket and you can book some great value accommodation too! Check it out online.

Travel Agency
We are a Queen's Award winning travel agency here to help with your travel plans.

Cuba Holidays
After years of neglect by the western world, Cuba is coming back onto the holiday scene. Cuba Holidays are a unique and enjoyable experience. Book at dealchecker.co.uk.

Holidays in Cyprus
Holidays in Cyprus are enriched by the abundance of churches, ruins and natural wonders. Book a holiday with us today!

Cheap Egypt Holidays
Pick up a bargain cheap Egypt holiday online when you visit ulookubook.com. Just check out our tips to make sure you book at the right time to get a great holiday for a great price. Finding cheap Egypt holidays can be simple when you know how.

Family package holidays
Save a lot of time and opt for one of the great family package holidays at Travel.co.uk

Cheap holidays to Portugal
Enjoy a spectacular country at a fraction of the cost. Find information on cheap holidays to Portugal 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