FRAMES | NO FRAMES | |
Get a list of standard geographic area names and IDs which intersect a given point location.
StdGeographiesReturnedFeature[] ReturnStdGeography ( ReturnStdGeographyParams Parameters );
Parameter | Description |
---|---|
Parameters | Geographic search parameters. Type ReturnStdGeographyParams. |
Variable of type StdGeographiesReturnedFeature[].
The Return Standard Geography utility service queries Business Analyst standard geography/administrative boundary data layers for standard geographic features intersecting the given point location. The service provides spatial context. The result of this service is an array of StdGeographiesReturnedFeatures objects which contains the list of intersecting standard geography/administrative boundary features, including their feature IDs. These feature IDs can be used to specify the associated geographic areas in subsequent operations in an analysis workflow.
The Return Standard Geography service returns a list of intersecting standard geography features for a given point location for one or more standard geography levels using a latitude-longitude coordinate pair, a street address, or the centroid (geographic center) of a ZIP code.
Some applications of Return Standard Geography 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); ReturnStdGeographyParams parameters = new ReturnStdGeographyParams(); parameters.GeoLevelIDs = new string[] {"US.WholeUSA", "US.States", "US.Counties", "US.Tracts", "US.ZIP5", "US.BlockGroups", "US.CBSA", "US.DMA", "US.Places", "US.CD", "US.CS"}; // One and only one of the three locations need be specified - address, coordinates or zip. parameters.Coordinates = new double[] { -117.195, 34.057 }; //parameters.Address = new string[] { "380 New York St.", "Redlands", "CA" }; //parameters.ZIP = "92373"; StdGeographiesReturnedFeature[] features = baoReportHelper.ReturnStdGeography(parameters); |
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) Dim parameters As New ReturnStdGeographyParams() parameters.GeoLevelIDs = New String() {"US.WholeUSA", "US.States", "US.Counties", "US.Tracts", "US.ZIP5", "US.BlockGroups", _ "US.CBSA", "US.DMA", "US.Places", "US.CD", "US.CS"} ' One and only one of the three locations need be specified - address, coordinates or zip. parameters.Coordinates = New Double() {-117.195, 34.057} 'parameters.Address = new string[] { "380 New York St.", "Redlands", "CA" }; 'parameters.ZIP = "92373"; Dim features As StdGeographiesReturnedFeature() = baoReportHelper.ReturnStdGeography(parameters) |
Example 2: Return a list of standard geography feature IDs which intersect a location specified by lat-lon coordinates and specified Business Analyst standard geography data layers (See Get Standard Geography Levels to lookup the IDs of the data layers accessible from your 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); ReturnStdGeographyParams parameters = new ReturnStdGeographyParams(); parameters.GeoLevelIDs = new string[] { "US.Counties", "US.ZIP5", "US.BlockGroups" }; // One and only one of the three locations need be specified - address, coordinates or zip. parameters.Coordinates = new double[] { -117.195, 34.057 }; //parameters.Address = new string[] { "380 New York St.", "Redlands", "CA" }; //parameters.ZIP = "92373"; // Associate the token with the request parameters.token = token; // Instantiate the BAOReport proxy object to submit the // request BAOReport baoReportProxy = new BAOReport(); StdGeographiesReturnedFeature[] features = baoReportProxy.ReturnStdGeography(parameters); |
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) Dim parameters As New ReturnStdGeographyParams() parameters.GeoLevelIDs = New String() {"US.Counties", "US.ZIP5", "US.BlockGroups"} ' One and only one of the three locations need be specified - address, coordinates or zip. parameters.Coordinates = New Double() {-117.195, 34.057} 'parameters.Address = new string[] { "380 New York St.", "Redlands", "CA" }; 'parameters.ZIP = "92373"; ' Associate the token with the request parameters.token = token ' Instantiate the BAOReport proxy object to submit the ' request Dim baoReportProxy As New BAOReport() Dim features As StdGeographiesReturnedFeature() = baoReportProxy.ReturnStdGeography(parameters) |