Community of VE/MapPoint Users and Developers
This is a discussion on How to get lat/long coordintates with VBA Excel within the Development forums, part of the MapPoint 2006/2009 Discussion category; Hi, I have the problem that I found an address with the FindAddressResults method and set a pushpin on that ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| How to get lat/long coordintates with VBA Excel I have the problem that I found an address with the FindAddressResults method and set a pushpin on that point. What i want to know is how to get the lat/long/alt coordinates for that point automaticly via VBA Code in my excel sheet. So I have hundreds of addresses with pushpins and want to have a list with lat/long coordinates for it. Thx right now, Kikolino |
| |||
| Re: How to get lat/long coordintates with VBA Excel
Hi, FindAddressResults returns a collection of Location and other objects. So if resultsquality is ok then loop in the result until it is a Location object. Then you can add a pushpin with that Location object and this object has also Latitude / Longitude information, so you have all you need
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: How to get lat/long coordintates with VBA Excel
Hi Wilfried! Thank you for your answer. I know what you are meaning and it helped to understand the problem but I still have the problem that I donīt know how to get the lat/long by writing a VBA Code. My code is the following: Private Sub CommandButton1_Click() Dim objFindResults As MapPoint.FindResults Dim objLoc As MapPoint.Location Dim objPushpin As MapPoint.Pushpin Dim Bereich As Range Dim Zelle As Range Set oApp = CreateObject("MapPoint.Application") Set objMap = oApp.NewMap Set objRoute = objMap.ActiveRoute Dim nCurrentRow As Integer nCurrentRow = 2 szAddress = Cells(nCurrentRow, 4) Do While (szAddress <> 0) szName = Cells(nCurrentRow, 1) szcity = Cells(nCurrentRow, 3) szZip = Cells(nCurrentRow, 2) Set objFindResults = objMap.FindAddressResults(szAddress, szcity, szZip) Set objLoc = objFindResults(1) Set objPushpin = objMap.AddPushpin(objLoc, szName) objPushpin.BalloonState = geoDisplayName nCurrentRow = nCurrentRow + 1 szAddress = Cells(nCurrentRow, 4) Loop And now i want to get the lat/long coordinates for each pushpin and afterwards calcute the distances between them. But I donīt know how... objPushin... distance.calculate... Perhaps you can help me again, that would be great! Greetz Kikolino |
| |||
| Re: How to get lat/long coordintates with VBA Excel
To get the latitude and longitude I think all you need is 'Get latitude of this location Lat = objLoc.Latitude 'Get longitude of this location Lon = objLoc.Longitude To get distance then calculate the route and apply objRoute.Distance …………..for the driving distance objRoute.DrivingTime …………….for the driving time objMap.Distance(objLoc1, objLoc2) ………….for the straight line distance
__________________ David MapPoint Europe Gallery at http://www.broomanalysis.plus.com/gallerylist.html Last edited by davidb; 02-11-2008 at 07:02 AM. |
| ||||
| Re: How to get lat/long coordintates with VBA Excel
The Latitude and Longitude properties are only guaranteed to be set if you are working with MapPoint 2006. Earlier versions only set these fields if the object was created with coordinates! (search this site for "CalcPos" for a cunning solution from Gilles) Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
![]() |
| ||||
| Posted By | For | Type | Date | |
| Working With Excel and MapPoint - MP2K Magazine | This thread | Refback | 02-10-2008 12:27 PM | |
| The Magazine for MapPoint - MP2K Magazine | This thread | Refback | 02-06-2008 09:25 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding Lat/long to polyline from excel | DeepBlue | MapPoint 2006/2009 Discussion | 3 | 05-15-2007 06:59 AM |
| setting up macro in excel to extract lat/long from map point | TransportationNut05 | MapPoint 2006/2009 Discussion | 2 | 08-24-2005 10:45 AM |
| Exporting Lat/Long of State Boundaries to Excel | Rpirong | MapPoint 2006/2009 Discussion | 2 | 05-12-2005 10:26 AM |
| Locate City and zip code using lat and long (Excel Macro) | sberhe | Wish List | 0 | 04-01-2005 09:31 AM |
| MPControl embedded in excel - excel loses functionality | ruyasan | MapPoint 2006/2009 Discussion | 2 | 05-20-2004 03:41 AM |
Flight Departures
Check Holiday Hypermarket to find flight departures to numerous exotic destinations. We link to details on flight departures and arrivals to help you find information fast.
Spain Holidays
Find and book Spain Holidays with Travel Counsellors. Holiday destinations around the world including Spain.
Italy Holiday
An Italy Holiday is full of interesting stuff for the casual tourist and even more for the educated visitor. Check out the latest great deals at dealchecker.co.uk.
Holidays to Antigua
The Holiday Place has fantastic deals on holidays to Antigua. Visit our website to view special offers on holidays to the Caribbean.
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.
Cheap Travel
For cheap travel options, visit Travel.co.uk and explore the benefits of our comparison site.
Cheap Holidays to Sharm el Sheikh
Break away to Northern Africa. Find cheap holidays to Sharm el Sheikh at On The Beach.