ServerAPI.UpdateNearbyCategory Method

Updates an existing nearby category in the MapPoint Location Server.

Public Sub UpdateNearbyCategory (category As Microsoft.MapPoint.LocationServer.Types.FindNearbyCategory)

[C#]
public UpdateNearbyCategory (Microsoft.MapPoint.LocationServer.Types.FindNearbyCategory category);

Parameters

  • category
    An instance of the FindNearbyCategory class. When updating an existing category, the following rules must be followed:

    The category KeyName property must not be null, and less than or equal to the maximum allowed length. The maximum allowed length of the KeyName property is defined in the MapPoint Location Server Parameter Lengths document.

    The category DefaultCulture property must not be null, and less than or equal to the maximum allowed length. The maximum allowed length of the DefaultCulture property is defined in the MapPoint Location Server Parameter Lengths document. Also, the DefaultCulture property must follow the standard culture definition.

Remarks

If an attempt is made to update a nearby category that does not exist in the Location Server, the FindNearbyCategoryNotFoundException exception is thrown.

Example

 
[Visual Basic]
    'Create a new instance of the ServerAPI class
    Dim MyServerAPI As New ServerAPI
    Try

        'Initialize the database connection for ServerAPI operations
        MyServerAPI.Initialize("Your SQL Server Name", "LocationServerDB")

        'Create a FindNearbyCategory instance
        Dim category As New FindNearbyCategory
        'Set the default culture
        category.DefaultCulture = "en-US"
        'Set the Distance Units
        category.DistanceUnit = DistanceUnit.Mile
        'Set the Key Name
        category.KeyName = "MyDiningPlaces"

        'Set the names for Localization. In this case we have to localized names
        'The following name is for English (US)
        Dim MyFindNearbyCategoryNames(1) As FindNearbyCategoryName

        MyFindNearbyCategoryNames(0) = New FindNearbyCategoryName
        MyFindNearbyCategoryNames(0).Culture = "en-US"
        MyFindNearbyCategoryNames(0).DisplayName = "My Dining Places"
        MyFindNearbyCategoryNames(0).DisplayDescription = "My Dining Places"
        'The following name is for German (Germany)
        MyFindNearbyCategoryNames(1) = New FindNearbyCategoryName
        MyFindNearbyCategoryNames(1).Culture = "de-DE"
        MyFindNearbyCategoryNames(1).DisplayName = "Meine Speisenden Pl?tze"
        MyFindNearbyCategoryNames(1).DisplayDescription = "Meine Speisenden Pl?tze"

        'Assign the localized names to the category instance
        category.Names = MyFindNearbyCategoryNames

        'Create a FindNearbySpecification
        Dim MyFindNearbyCategorySpecification As New FindNearbySpecification
        'Update this value from NavTech.NA to Acxiom.US.SIC_G.58
        MyFindNearbyCategorySpecification.DataSourceName = "Acxiom.US.SIC_G.58"
        MyFindNearbyCategorySpecification.Filter = New FindFilter
        'Update this value from SIC3578 to SIC5813
        MyFindNearbyCategorySpecification.Filter.EntityTypeName = "SIC5813"
        'Assign the FindNearbySpecification to the category
        category.FindNearbySpecification = MyFindNearbyCategorySpecification

        'Now update the category
        MyServerAPI.UpdateNearbyCategory(category)


    Catch MyException As Exception

        'Process your exceptions here
        Console.WriteLine(MyException.GetType().Name)

    Finally
        'Do cleanup
        MyServerAPI = Nothing
    End Try

 
[C#]
  //Create a new instance of the ServerAPI class
  ServerAPI MyServerAPI = new ServerAPI();
  try
  {
   //Initialize the database connection for ServerAPI operations
   MyServerAPI.Initialize("Your SQL Server Name", "LocationServerDB");

   //Create a FindNearbyCategory instance
   FindNearbyCategory category = new FindNearbyCategory();
   //Set the default culture
   category.DefaultCulture = "en-US";
   //Set the Distance Units
   category.DistanceUnit = DistanceUnit.Mile;
   //Set the Key Name
   category.KeyName = "MyDiningPlaces";

   //Set the names for Localization. In this case we have to localized names
   //The following name is for English (US)
   FindNearbyCategoryName[] MyFindNearbyCategoryNames = new FindNearbyCategoryName[2];

   MyFindNearbyCategoryNames[0] = new FindNearbyCategoryName();
   MyFindNearbyCategoryNames[0].Culture = "en-US";
   MyFindNearbyCategoryNames[0].DisplayName = "My Dining Places";
   MyFindNearbyCategoryNames[0].DisplayDescription = "My Dining Places";
   //The following name is for German (Germany)
   MyFindNearbyCategoryNames[1] = new FindNearbyCategoryName();
   MyFindNearbyCategoryNames[1].Culture = "de-DE";
   MyFindNearbyCategoryNames[1].DisplayName = "Meine Speisenden Pl?tze";
   MyFindNearbyCategoryNames[1].DisplayDescription = "Meine Speisenden Pl?tze";

   //Assign the localized names to the category instance
   category.Names = MyFindNearbyCategoryNames;

   //Create a FindNearbySpecification
   FindNearbySpecification MyFindNearbyCategorySpecification = new FindNearbySpecification();
   //Update this value from NavTech.NA to Acxiom.US.SIC_G.58
   MyFindNearbyCategorySpecification.DataSourceName = "Acxiom.US.SIC_G.58";
   MyFindNearbyCategorySpecification.Filter = new FindFilter();
   //Update this value from SIC3578 to SIC5813
   MyFindNearbyCategorySpecification.Filter.EntityTypeName = "SIC5813";
   //Assign the FindNearbySpecification to the category
   category.FindNearbySpecification = MyFindNearbyCategorySpecification;

   //Now update the category
   MyServerAPI.UpdateNearbyCategory(category);
    
  }
  catch(Exception MyException)
  {
   //Process your exceptions here
   Console.WriteLine(MyException.GetType().Name);
  }
  finally
  {
   //Do cleanup
   MyServerAPI = null;
  }

  
 

See Also

FindNearbyCategory  |  FindNearbyCategoryNotFoundException  |  Microsoft.MapPoint.LocationServer.Management  |  ServerAPI Class  |  ServerAPI Members  |  ServerAPIException Class