ArcGIS Geocode Search service


Purpose
This sample shows how to create an application Web service that incorporates geographic information system (GIS) functionality using an ArcGIS for Server geocode and geometry service. The Web service geocodes an input address, buffers the geocoded point using a geometry service, and returns a list of school districts within the buffer. The sample contains implementation code showing the use of the ArcGIS for Server Simple Object Access Protocol (SOAP) and ArcObjects application programming interfaces (APIs). To use this sample, you must have the ArcGIS for Server Application Developer Framework (ADF) for the Microsoft .NET framework installed on the Web server machine. You must also have an ArcGIS for Server instance with a pooled geocode service named RoadCenterline_Locator and a geometry service and
BloomfieldTownship mapservice running. The RoadCenterline_Locator geocode server object references the locator RoadCenterline_Locator.loc included with the sample data.
Note: Local (DCOM) connections are only supported for ArcGIS for Server versions prior to 10.1.

How to use

Data has been provided for your use with this sample. It can be found at <Your ArcGIS Developer Kit Install directory>/Samples/data/BloomfieldTownship/RoadCenterline_Locator.loc and <Your ArcGIS Developer Kit Install directory>/Samples/data/BloomfieldTownship/BloomfieldTownship.mxd.
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

At design time
  1. Verify that the Web ADF for the .NET framework is installed and functioning properly. For information on installing and configuring the Web ADF, consult the installation guide.
  2. Add the RoadCenterline_Locator.loc as a geocode server object named RoadCenterline_Locator to your GIS Server. Sample data is located in <ArcGIS Developer Kit install location>\Samples\data.
  3. In Windows Explorer, navigate to <ArcGIS Developer Kit install location>\Samples\ServerNET\ArcGIS_Geocode_Search, where there will be a CSharp and VBNet folder.
  4. In Windows Explorer, open the directory referencing the necessary language, that is, CSharp or VBNet. Open the solution file.
  5. Click the Debug menu, choose Start Debugging or press F5. If successful, the ArcGIS_Geocode_Search_<language> application starts.
  6. Make sure to change the ADF Indentity parameters in SchoolDistrictLocatorService.cs file.
  7. Address any errors that occur in the debugging process.

At run time
  1. Open a Web browser and navigate to the Web application uniform resource locator (URL), for example, http://localhost/ArcGIS_Geocode_Search_CSharp/SchoolDistrictLocatorService.asmx, or start the Web application in Visual Studio.
  2. Click FindSchoolDistrictLocationsArcObjects (for Arcobjects) or FindSchoolDistrictLocationsSoap (for SOAP) public WebMethods exposed in the Web service.
  3. Specify the parameters as follows—FullAddress: 1575 Apple Ln 48304 and Distance: 1000.
  4. The FullAddress parameter is used in the geocode process to determine a location (point). The geocoded point is buffered to select school districts in the SchooltaxDistricts feature class. The attributes of selected locations in the feature class are returned in the Web service response. The page shows the results of the geocode and search in SOAP Extensible Markup Language (XML) format.

ArcGIS_Geocode_Search_CSharp\SchoolDistrictLocatorService.asmx Web service endpoint.
ArcGIS_Geocode_Search_CSharp\App_Code\SchoolDistrict.cs Complex type composed of primitives data types. Used to package data in the Web service response.
ArcGIS_Geocode_Search_CSharp\App_Code\SchoolDistrictLocatorService.cs Contains the business logic to geocode, buffer, and search the SchoolDistrict feature class.
ArcGIS_Geocode_Search_CSharp\App_Code\Utility.cs Contains utility classes to assist service operations.
Download the C# files
ArcGIS_Geocode_Search_VBNet\SchoolDistrictLocatorService.asmx Web service endpoint.
ArcGIS_Geocode_Search_VBNet\App_Code\SchoolDistrict.vb Complex type composed of primitives data types. Used to package data in the Web service response.
ArcGIS_Geocode_Search_VBNet\App_Code\SchoolDistrictLocatorService.vb Contains the business logic to geocode, buffer, and search the SchoolDistrict feature class.
ArcGIS_Geocode_Search_VBNet\App_Code\Utility.vb Contains utility classes to assist service operations.
Download the VB.NET files

Download the files for all languages

See Also:

Walkthrough: How to create a geocode and search Web service