Home arrow GIS Data & Resources arrow Scripts and Code arrow C# Code arrow ArcGIS Server 9.2 - How to Geocode
ArcGIS Server 9.2 - How to Geocode PDF Print E-mail

Written by Steve Gourley,


This article describes how to geocode an address in ArcGIS Server using a web service provided by AGRC in Visual Studio .NET.

This is rather simple if you utilize our web service.

  • First Register with http://mapserv.utah.gov
  • Second, Follow the guide on how to use SOAP web services on mapserv.utah.gov and add a class of the geocoding web service.
  • Third, create a button with two text boxes. The button will fire the method below and the textboxes will be the city and zip.

private string geoCodeAddress(string city, string zip)
    {

        string userName = "your registered username";
        try
        {
            geocode.UTSGID_GeoLocator geolocator = new geocode.UTSGID_GeoLocator();
            geocode.GeocodeResult address = geolocator.GeocodeAddress(userName, city, zip);

            ESRI.ArcGIS.ADF.Web.Geometry.Point point;

            if (address.Geocoder != "Not Found")
            {
                point = new ESRI.ArcGIS.ADF.Web.Geometry.Point(address.UTM_X, address.UTM_Y);

                    Map1.Zoom(Map1.Scale / 1500, point);
                    Map1.Refresh();           

            }
            else
            {
                //handle error
            }
        }
        catch (Exception)
        {
            //handle error
        }
    }



Users' Comments  
 

No comment posted

Add your comment

25, Oct. 2007
Last Updated ( 09, Jan. 2008 )
 
< Prev   Next >

AGRC Contacts | UGIC Contacts

feed image feed image

Utah GIS Portal © 2009 AGRC

Optimized for