dambrowsky
02-02-2008, 09:27 AM
Dear specialists,
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
Mattys Consulting
02-02-2008, 09:26 PM
Hi Peter,
Look up the ObjectFromPoint method.
Mike Mattys
dambrowsky
02-03-2008, 03:26 AM
Hi Mike,
Thank you for quick answer and the Tip. I will try to use it and then we will see what will happen.
Best regards
Peter :p
208_Fireball
02-04-2008, 06:37 PM
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.
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;
}
Cheers,
Dave
dambrowsky
02-05-2008, 02:04 AM
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:roll:
Wilfried
02-05-2008, 04:31 AM
Hi,
Yes, you can set the active map's Visible to false. it also will speed up.