Community of VE/MapPoint Users and Developers
This is a discussion on Find latitude and longitude of map corners with VBA within the Development forums, part of the MapPoint 2006/2009 Discussion category; Hi, I use the following code to place pushpins on a map and zoom in the area. Do Until oWorksheet2.Cells(i, ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Find latitude and longitude of map corners with VBA I use the following code to place pushpins on a map and zoom in the area. Do Until oWorksheet2.Cells(i, 1) = 0 sStation = oWorksheet2.Cells(i, 1) Set oStation = oMap.FindResults(sStation).Item(1) oMap.AddPushpin oStation i = i + 1 Loop oMap.DataSets.ZoomTo I also use the code http://www.mp2kmag.com/a13--kohl.extract.lat.lon.mappoint.html to find latitude and longitude of each pushpin. However, I also need to know what is the latitude and longitude of each corner of my map. How can I do that with VBA code. Thanks for help A.Ouellet p.s: I am a french Canadian. I am sorry for all possible English mistakes. |
| |||
| Re: Find latitude and longitude of map corners with VBA
Well ... I might do it like this: Type LATLONGPOINT x As Double y As Double End Type Dim CNW As LATLONGPOINT Dim CNE As LATLONGPOINT Dim CSW As LATLONGPOINT Dim CSE As LATLONGPOINT Dim NWC As MapPointCtl.Location Dim NEC As MapPointCtl.Location Dim SWC As MapPointCtl.Location Dim SEC As MapPointCtl.Location Dim dblLatNWC As Double Dim dblLongNWC As Double Dim dblLatSWC As Double Dim dblLongSWC As Double Dim dblLatNEC As Double Dim dblLongNEC As Double Dim dblLatSEC As Double Dim dblLongSEC As Double Public Function OutputDimensions() 'Mattys Consulting Dim dblWidthTop As Double, dblWidthBottom As Double Dim dblHeightWest As Double, dblHeightEast As Double CNW.x = 0: CNW.y = 0 CSW.x = 0: CSW.y = oMap.Height CNE.x = oMap.Width: CNE.y = 0 CSE.x = oMap.Width: CSE.y = oMap.Height On Error Resume Next Set NWC = oMap.XYToLocation(CNW.x, CNW.y) Set SWC = oMap.XYToLocation(CSW.x, CSW.y) Set NEC = oMap.XYToLocation(CNE.x, CNE.y) Set SEC = oMap.XYToLocation(CSE.x, CSE.y) If (dblLatNWC = 0 And dblLongNWC = 0) = False Then 'CalcPos courtesy of Gilles Kohl CalcPos oMap, NWC, dblLatNWC, dblLongNWC CalcPos oMap, SWC, dblLatSWC, dblLongSWC CalcPos oMap, NEC, dblLatNEC, dblLongNEC CalcPos oMap, SEC, dblLatSEC, dblLongSEC 'Add pushpins if desired Set NWC = oMap.GetLocation(dblLatNWC, dblLongNWC) Set SWC = oMap.GetLocation(dblLatSWC, dblLongNWC) Set NEC = oMap.GetLocation(dblLatNWC, dblLongNEC) Set SEC = oMap.GetLocation(dblLatSWC, dblLongNEC) dblWidthTop = oMap.Distance(NWC, NEC) dblWidthBottom = oMap.Distance(SWC, SEC) dblHeightWest = oMap.Distance(NWC, SWC) dblHeightEast = oMap.Distance(NEC, SEC) End If End Function If you have any questions, just ask. Mike Mattys |
![]() |
| Tags |
| corners, find, latitude, longitude, map, vba |
| ||||
| Posted By | For | Type | Date | |
| Area in Mappoint - microsoft.public.mappoint | Google Gruppi | This thread | Refback | 01-16-2008 11:38 AM | |
| MapPoint Articles - MP2K Magazine | This thread | Refback | 05-29-2007 09:51 AM | |
| Determing Whether A Point Is Located Inside Polygon - MapPoint Articles - MP2K Magazine | This thread | Refback | 05-19-2007 08:07 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| find Location Name through Longitude Latitude | Anonymous | MapPoint 2006/2009 Discussion | 3 | 07-24-2008 01:58 AM |
| Using longitude and latitude to find adress | Edward_Carnby | MapPoint 2006/2009 Discussion | 4 | 07-22-2008 09:12 AM |
| How to get latitude and longitude | ma2005pp | MapPoint 2006/2009 Discussion | 3 | 09-28-2005 02:57 AM |
| Latitude and Longitude | virgilar | MapPoint 2006/2009 Discussion | 1 | 03-21-2005 02:01 PM |
| NMEA latitude/longitude and mappoint latitude/longitude | muurman | MapPoint 2006/2009 Discussion | 3 | 11-22-2003 05:42 AM |