ServerAPI.GetNearbyCategories Method
Gets the Find Nearby categories based on the culture name.
Public Function GetNearbyCategories (culture As System.String)
_ As Microsoft.MapPoint.LocationServer.Types.FindNearbyCategory()
[C#]
public Microsoft.MapPoint.LocationServer.Types.FindNearbyCategory[] GetNearbyCategories (System.String culture);
Parameters
culture
The culture name in the format "languagecode2-regioncode2", where languagecode2 is a lowercase two-letter code derived from International Organization for Standardization (ISO) 639-1 and regioncode2 is an uppercase two-letter code derived from ISO 3166. For example, "en-US" denotes English (United States). For more information about valid culture names, see Valid Culture Names .If no culture is passed (null in C# and Nothing in Microsoft® Visual Basic® .NET), the results for all cultures are returned and the array of Find Nearby categories is not sorted.
When a value for a culture is passed, the search process uses the culture in the following ways:
Specific culture match—If a Find Nearby category has a DisplayName property defined for the culture, the DisplayName property and the corresponding DisplayDescription property are returned. Neutral culture match—If no exact match is found for the specific culture, the neutral culture (language) is used to find the matching DisplayName and DisplayDescription. E.g., if the passed specific culture is “de-DE”, then its neutral culture is “de”. If the category has no DisplayName defined for “de-DE” but it has a DisplayName for “de”, then this DisplayName and its corresponding DisplayDescription is returned. Default match: If the above searches fail to find a DisplayName and DisplayDescription based on both specific and neutral cultures, then the DisplayName and DisplayDescription for the category’s DefaultCulture are returned.
The returned array is alphabetically sorted in ascending order based on the DisplayName of the find nearby category localized names property (i.e., FindNearbyCategoryName.DisplayName). The culture that is being passed is used for sorting the array.
For the definition for find nearby category in the MapPoint Location Server, see the glossary.
Remarks
A null value is returned if no Find Nearby categories are found.
For more information about culture names, see Valid Culture Names .
Example
[Visual Basic]
'Microsoft SQL Server and database instance names
Const server As String = "Your SQL Server Name"
Const database As String = "LocationServerDB"
'Create a ServerAPI instance.
Dim MyServerAPI As New ServerAPI
Try
'Call initialize
Call MyServerAPI.Initialize(server, database)
'Now get the NearByCategories based on the culture name.
Dim culture As String = "en-US"
Dim MyFindNearbyCategories As FindNearbyCategory() = MyServerAPI.GetNearbyCategories(culture)
For Each MyFindNearbyCategory As FindNearbyCategory In MyFindNearbyCategories
Console.WriteLine(MyFindNearbyCategory.KeyName)
Next
Catch MyException As Exception
'Your exception processing go
End Try
[C#]
//Set the computer running SQL Server and database instance names.
const string server = "Your SQL Server Name";
const string database = "LocationServerDB";
//Create a new instance of the ServerAPI class.
//Call the Initialize() method to initialize the
//ServerAPI instance.
//...
//Now get the NearByCategories based on the culture name.
try
{
string culture = "en-US";
FindNearbyCategory[] MyFindNearbyCategories = MyServerAPI.GetNearbyCategories(culture);
foreach(FindNearbyCategory fn in MyFindNearbyCategories)
{
Console.WriteLine(fn.KeyName);
}
}
catch(Exception MyException)
{
//Your exception processing goes here.
}
See Also
FindNearbyCategory | Microsoft.MapPoint.LocationServer.Management | ServerAPI Class | ServerAPI Members | ServerAPIException Class