FRAMES | NO FRAMES | |
Get a list of all available geographic boundary data layers in the Business Analyst Online dataset.
IDNamePair[] GetStandardGeographyLevels ( String ActiveDatasetID, String token );
Parameter | Description |
---|---|
ActiveDatasetID | Specify a dataset to perform Online API tasks or operations. |
token | User authentication token received from Authentication Web Service. Type String. |
Variable of type IDNamePair[].
The Get Standard Geography Levels utility service returns a list of available Business Analyst Online data layers corresponding to different standardized administrative areas such as U.S. states, counties, Core Based Statistical Areas (CBSAs), Designated Market Areas (DMAs), cities, ZIP codes, Congressional Districts, Census tracts, and Census block groups. The result of this service is an array of IDNamePairs which will contain the data layer IDs and their corresponding names. These IDs can be used to specify standard geography/administrative boundary data layers in other analysis.
The Get Standard Geography Levels service returns a list of available geography data layers. These geography data layer IDs may be used to specify specific areas to perform a Summary Reports analysis on using a StdLayer type for the value of the Boundaries parameter. These IDs may also be used to specify a geography data layer for a name based query (Standard Geographies by Attributes) or a spatial query (Standard Geographies from Extent). Analysis areas in Benchmark Report can be specified from a Standard Geography/administrative boundary data layer. Data layers IDs are specified in the Return Standard Geography service to designate the query layers.
Some applications of Get Standard Geography Levels include the following:
Example (1) Code
C# |
// Authentication: Uses BAOReportHelper class for token management. // Instantiate BAOReportHelper class string tokenServiceUrl = "https://baoapi.esri.com/bawebservices/rest/authentication"; // Business Analyst Online API Sample credentials. // NOTE: These credentials are associated with an // account which constrains analysis to the // two ZIP codes in Redlands, CA. string username = "BAOAPISAMPLE"; // Substitute user name here string password = "baoapisample"; // Substitute password here ITokenProvider tokenProvider = new HTTPTokenProvider(tokenServiceUrl, username, password); BAOReportHelper baoReportHelper = new BAOReportHelper(tokenProvider); // Execute the task // When the ActiveDatasetID paramter value is null, the default // dataset is specified. See GetDatasets to obtain a list of // available datasets. IDNamePair[] levels = baoReportHelper.GetStandardGeographyLevels(null); // Iterate through geography levels and create their description in the // levelDescriptions array string[] levelDescriptions = new string[levels.Length]; for (int i = 0; i < levels.Length; i++) { levelDescriptions[i] = "ID: " + levels[i].ID + " NAME: " + levels[i].Name; } |
Example (1) Code
VB.NET |
' Authentication: Uses BAOReportHelper class for token management. ' Instantiate BAOReportHelper class Dim tokenServiceUrl As String = "https://baoapi.esri.com/bawebservices/rest/authentication" ' Business Analyst Online API Sample credentials. ' NOTE: These credentials are associated with an ' account which constrains analysis to the ' two ZIP codes in Redlands, CA. Dim username As String = "BAOAPISAMPLE" ' Substitute user name here Dim password As String = "baoapisample" ' Substitute password here Dim tokenProvider As ITokenProvider = New HTTPTokenProvider(tokenServiceUrl, username, password) Dim baoReportHelper As New BAOReportHelper(tokenProvider) ' Execute the task Dim levels As IDNamePair() = baoReportHelper.GetStandardGeographyLevels(Nothing) ' Iterate through geography levels and create their description in the ' levelDescriptions array Dim levelDescriptions As String() = New String(levels.Length - 1) {} For i As Integer = 0 To levels.Length - 1 levelDescriptions(i) = ("ID: " + levels(i).ID & "; NAME: ") + levels(i).Name Next |
Example 2: Retrieve a list of Business Analyst standard geography data layers and their IDs which can be accessed with a specific Business Analyst Online API subscription account.
Notes: Example 2 demonstrates code which consumes the BAOReport proxy class (generated from the WSDL ) without leveraging the BAOReportHelper class. Please view Example 1 above for additional information about the BAOReportHelper class.
Example (2) Code
C# |
// Authentication: Uses Authentication proxy class to generate token. // Business Analyst Online API Sample credentials. // NOTE: These credentials are associated with an // account which constrains analysis to the // two ZIP codes in Redlands, CA. string username = "BAOAPISAMPLE"; // Substitute user name here string password = "baoapisample"; // Substitute password here Authentication auth = new Authentication(); string token = auth.getToken(username, password); // Instantiate the BAOReport proxy object to submit the // request BAOReport baoReportProxy = new BAOReport(); // Execute the task // When the ActiveDatasetID paramter value is null, the default // dataset is specified. See GetDatasets to obtain a list of // available datasets. IDNamePair[] levels = baoReportProxy.GetStandardGeographyLevels(null, token); // Iterate through geography levels and create their description in the // levelDescriptions array string[] levelDescriptions = new string[levels.Length]; for (int i = 0; i < levels.Length; i++) { levelDescriptions[i] = "ID: " + levels[i].ID + " NAME: " + levels[i].Name; } |
Example (2) Code
VB.NET |
' Authentication: Uses Authentication proxy class to generate token. ' Business Analyst Online API Sample credentials. ' NOTE: These credentials are associated with an ' account which constrains analysis to the ' two ZIP codes in Redlands, CA. Dim username As String = "BAOAPISAMPLE" ' Substitute user name here Dim password As String = "baoapisample" ' Substitute password here Dim auth As New Authentication() Dim token As String = auth.getToken(username, password) ' Instantiate the BAOReport proxy object to submit the ' request Dim baoReportProxy As New BAOReport() ' Execute the task Dim levels As IDNamePair() = baoReportProxy.GetStandardGeographyLevels(Nothing, token) ' Iterate through geography levels and create their description in the ' levelDescriptions array Dim levelDescriptions As String() = New String(levels.Length - 1) {} For i As Integer = 0 To levels.Length - 1 levelDescriptions(i) = ("ID: " + levels(i).ID & "; NAME: ") + levels(i).Name Next |