FindServiceSoap.GetLocationInfo Method
FindServiceSoap.GetLocationInfo Method
Finds geographic entities and addresses for a specified latitude and longitude coordinate (sometimes known as reverse geocoding). Returns an array of locations (Location[] objects). Maximum returned value is 250.
Public Function GetLocationInfo (ByVal location As LatLong, ByVal dataSourceName As System.String, ByVal options As GetInfoOptions) _
As Location()
[C#]
public Location[] GetLocationInfo (LatLong location, System.String dataSourceName, GetInfoOptions options);
Parameters
- location
The latitude and longitude coordinate (LatLong object) for which to return location information.
- dataSourceName
The name of the data source to search. String.
- options
The search options (GetInfoOptions object), which identify whether to return addresses, location information for specified entity types or all entity types, or both. Default is to return both addresses and location information for all entity types. Optional.
Remarks
The GetLocationInfo does not return every possible entity type. The following table lists the entity types that can be returned:
AdminDivision1
Glacier
PopulatedPlace
AdminDivision2
Hemisphere
Postcode1
AdminDivision3
Ice
Postcode2
Archipelago
IndigenousPeoplesReserve
Postcode3
Bay
Island
Postcode4
Beach
Isthmus
Promontory
Census1
Lake
Reef
Census2
LandArea
Reserve
Channel
Landform
River
Coast
MountainRange
Satellite
Continent
Neighborhood
Sea
CountryRegion
Ocean
Sovereign
Crater
Park
StatisticalDistrict
CulturalRegion
Peninsula
TimeZone
Dependent
Plain
UrbanRegion
Desert
Planet
Valley
DisputedArea
Plate
WaterFeature
Forest
Plateau
Wetland
The GetLocationInfo method returns locations/addresses in order from nearest to the farthest from the specified latitude and longitude.
The GetLocationInfo method can be used to find context information about a specific latitude and longitude coordinate. For example, passing the latitude and longitude coordinate for an address in Seattle, WA, U.S. returns the entity representing King County as one of the results.
The GetLocationInfo method is valid with the MapPoint.AP, MapPoint.BR, MapPoint.EU, MapPoint.NA, MapPoint.World, and MapPoint.WorldRoutable data sources. For more information about MapPoint Web Service data sources, see MapPoint Web Service Data Sources and Capabilities.
Address information can be returned from only certain countries or regions within the MapPoint.AP, MapPoint.BR, MapPoint.EU, and MapPoint.NA data sources. For more information, see MapPoint.EU Data Source, and MapPoint.NA Data Source.
If address information is requested, up to four location objects with addresses are returned at the beginning of the array. If location information is also requested for entity types, these locations are returned after any locations with address information. If no address information is available for the specific latitude and longitude coordinate, no address information is returned.
Location information can be returned for only certain entity types.
A found location returned by the GetLocationInfo method does not include entity definition information. To get the EntityType.Definition property for a found location, use the CommonServiceSoap.GetEntityTypes method.
Note If you call the GetLocationInfo method when using the MapPoint.World or MapPoint.WorldRoutable data source, no address is returned in the Location.Address property.
Example
[Visual Basic]
'Output possible locations for a user at a specific latitude and longitude coordinate
Dim findService As New FindServiceSoap()
Dim myLatLong As New LatLong()
myLatLong.Latitude = 47.682
myLatLong.Longitude = -122.132
Dim returnedLocations() As Location
returnedLocations = findService.GetLocationInfo(myLatLong, "MapPoint.NA", Nothing)
Dim i As Integer
For i = 0 To returnedLocations.Length - 1
Console.WriteLine(returnedLocations(i).Entity.DisplayName)
Next
[C#]
//Output possible locations for a user at a specific latitude and longitude coordinate
FindServiceSoap findService = new FindServiceSoap();
LatLong myLatLong = new LatLong();
myLatLong.Latitude = 47.682;
myLatLong.Longitude = -122.132;
Location[] returnedLocations;
returnedLocations = findService.GetLocationInfo(myLatLong, "MapPoint.NA", null);
for(int i = 0; i < returnedLocations.Length; i++)
{
Console.WriteLine(returnedLocations[i].Entity.DisplayName);
}
See Also
FindServiceSoap Class | Location Class | LatLong Class | GetInfoOptions Class | CommonServiceSoap.GetEntityTypes Method