MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Getting Lat and long area from user's selection

This is a discussion on Getting Lat and long area from user's selection within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I am using the mappoint ActiveX control in a VB app. I want to get a range of lat and ...


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 01-20-2004
Junior Member
White Belt
 
Join Date: Jan 2004
Posts: 2
Getting Lat and long area from user's selection

I am using the mappoint ActiveX control in a VB app. I want to get a range of lat and long based on what area the user selects.

I can get the objMap.SelectedArea and I can check for pushpins, select pushpins etc but I can't get the lat and long of the selected area.

I can get the top, left, width, height of the selected area in relation to the active map but that is a far cry from getting the lat/long.

Does anyone know of a calculation I can use?

Thanks
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 01-21-2004
Member
Yellow Belt
 
Join Date: Sep 2003
Posts: 44
Here's what I use to do that
Code:
Dim sa As MapPoint.SelectedArea
        Dim dbllat As Double
        Dim dbllon As Double
        sa = objmap.SelectedArea

        objloc = objmap.XYToLocation(sa.Left, sa.Top)
        CalcPos(objmap, objloc, 1)
        objloc = objmap.XYToLocation(sa.Left + sa.Width, sa.Top + sa.Height)
        CalcPos(objmap, objloc, 2)
It gets the top left of the square, assigns it to a location object and then uses the code in the article below to obtain the long and lat, then does it again for the bottom right corner (got by taking the left and adding the width to it and the top and adding the height, I know in theory you should subtract the height from the top but heh it works!! )

http://www.mp2kmag.com/articles.asp?...xtract.lat.lon

M
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 02-18-2004
Bug's Avatar
Bug Bug is offline
Junior Member
White Belt
 
Join Date: Feb 2004
Posts: 6
I'm using a AxMappoint.AxMappointControl in my VB.NET project, and I don't get the "SelectedArea" option on my control. How can I get the selected area from an ActiveX control?
__________________
Best Regards.
Bug
Microsoft Certified Solutions Developer
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 02-19-2004
Member
Yellow Belt
 
Join Date: Sep 2003
Posts: 44
you won't get it as axmappointcontrol1.selectedarea, you have to declare a mappoint object, like objmap in my example above and its part of that



M
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 02-19-2004
Bug's Avatar
Bug Bug is offline
Junior Member
White Belt
 
Join Date: Feb 2004
Posts: 6
Well, I already have an ActiveX control on my form, so declaring a new mappoint control dosen't really help. I have tried to declare a mappoint.mappoint control and assign it to my ActiveX control, but i get an "Invalid cast" error. So apperently I can't use that interface with the ActiveX control. So I'm wondering how to get the selected area then? Am I overlooking something?
__________________
Best Regards.
Bug
Microsoft Certified Solutions Developer
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 02-23-2004
Member
Yellow Belt
 
Join Date: Sep 2003
Posts: 44
OK, now I'm back doing some coding work I'll show you exactly instead of from my note book

Code:
Dim objmap As MapPoint.Map
I normally dothat in the globals at the start, just in case

Code:
Me.AxMappointControl1.NewMap("C:\mymapname.ptm")
objmap = AxMappointControl1.ActiveMap
And thats in form.load

Once you've declared objmap as a mappoint object and assigned it to the active map of your control, selectedarea will be a control you can selet from it

M
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 02-23-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Just what I needed. Thanks.
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 02-23-2004
Bug's Avatar
Bug Bug is offline
Junior Member
White Belt
 
Join Date: Feb 2004
Posts: 6
I don't know why I overlooked that one. Thanks for your help. I got it working now.
__________________
Best Regards.
Bug
Microsoft Certified Solutions Developer
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 02-24-2004
Member
Yellow Belt
 
Join Date: Sep 2003
Posts: 44
no worries

M
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
area, lat, long, selection, user


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
Pushpin Selection EdB MapPoint 2006/2009 Discussion 2 08-14-2005 10:25 AM
Getting dataset from user selection mic6399 MapPoint 2006/2009 Discussion 1 09-23-2004 11:59 AM
Zoom to selection? sthurlock MapPoint 2006/2009 Discussion 6 12-10-2003 07:53 PM
[Multi pushpins selection ?] Vincent BENNER MapPoint 2006/2009 Discussion 4 01-30-2003 05:41 AM
Identifying Selection with Mouse MapPointJim MapPoint 2006/2009 Discussion 3 08-20-2002 05:39 PM


All times are GMT -5. The time now is 10:54 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 55