Community of VE/MapPoint Users and Developers
This is a discussion on Finding Streets by coordinates within the Development forums, part of the MapPoint 2006/2009 Discussion category; Dear specialists, I have coordinates (wsg84) and want to get the Adress (Town, Street and so on). How is it ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| I have coordinates (wsg84) and want to get the Adress (Town, Street and so on). How is it possible with MapPoint? I know how to get a location object. But how can I find out Town, Street from this object? Any help is welcome Best regards Peter |
| |||
| Re: Finding Streets by coordinates
Hi Peter, Look up the ObjectFromPoint method. Mike Mattys |
| |||
| Re: Finding Streets by coordinates
Note that ObjectsFromPoint takes screen coordinates, not latitudes and longitudes. The process you might want to follow is: - Form a Location with your desired lat/lon - Move to that location - Find the screen X,Y coordinates for that location - Call ObjectsFromPoint for that X,Y. In C++, you might call the following code. This is mostly from my head and hasn't been tested. Your class names may also differ slightly. Code: CString GetStreetName(double dLat, double dLon, double dAlt)
{
CMPMap thisMap;
CMPLocation locTest;
CMPLocation locTemp;
CMPFindResults mpFindResults;
CMPStreetAddress saddrLocation;
long lXPos;
long lYPos;
CString strResult = _T(""); // default
int nFound;
VARIANT vItem;
thisMap = m_mapMain.GetActiveMap();
locTest = thisMap.GetLocation(dLat, dLon, dAlt);
locTest.GoTo();
lXPos = thisMap.LocationToX(locTest);
lYPos = thisMap.LocationToY(locTest);
if ((lXPos != -1) && (lYPos != -1)) {
mpFindResults = thisMap.ObjectsFromPoint(lXPos, lYPos);
nFound = mpFindResults.GetCount();
if (nFound > 0) {
locTemp = mpFindResults.GetItem(&vItem);
saddrLocation = locTemp.GetStreetAddress();
if (saddrLocation.m_lpDispatch != NULL) {
strResult = saddrLocation.GetValue();
}
}
}
return strResult;
}
Dave Last edited by 208_Fireball; 02-04-2008 at 07:44 PM. |
| |||
| Re: Finding Streets by coordinates
Hi Dave, THank you. What you wrote is exectly what I do (in VB6). Is there a possibility to get the same result without displaing the chart? That means that I want to have a small software with input of the coordinates and output the adresse (city, street and so on) and no chart is shown. Best regards Peter |
| |||
| Re: Finding Streets by coordinates
Hi, Yes, you can set the active map's Visible to false. it also will speed up.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| coordinates, finding, streets |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Finding populations | donnagreek | MapPoint 2006/2009 Discussion | 2 | 08-28-2008 11:02 PM |
| MapPoint, Pocket Streets, Streets and Trips | chpw | MapPoint 2006/2009 Discussion | 3 | 01-04-2006 10:54 AM |
| thick streets vs. spindly streets - how? | Anonymous | MapPoint Web Service and Virtual Earth | 1 | 03-08-2005 07:32 AM |
| MapPoint web-service: THICK streets vs. spindly streets | Anonymous | MapPoint 2006/2009 Discussion | 0 | 03-07-2005 12:32 PM |
| How to find Streets reverse out of coordinates | Anonymous | MapPoint 2006/2009 Discussion | 1 | 03-18-2004 12:09 PM |