Getting started overview

The Utah Automated Geographic Reference Center (AGRC) provides a geocoding service optimized for addresses within Utah. This service allows developers to convert street addresses into geographic coordinates (latitude and longitude) and vice versa, specifically tailored for the state of Utah. This guide outlines the steps to create an account, obtain API credentials, and execute a foundational geocoding request.

The AGRC geocoding service is accessible via a REST API. It is designed for applications requiring high accuracy for Utah-specific location data, supporting both web and desktop environments. The service includes a free tier, allowing developers to test and integrate the API with no initial cost for up to 15,000 requests per month.

Here is a quick reference table for the getting started process:

Step What to Do Where
1. Sign Up Register for an AGRC developer account. AGRC Address Geocoding Service Page
2. Get API Key Generate your unique API key from your account dashboard. AGRC Account Dashboard (after signup)
3. Make Request Construct and send your first geocoding API call using your key. Your preferred development environment
4. Explore Docs Review advanced features, parameters, and error handling. AGRC Geocoding API Documentation

Create an account and get keys

To begin using the Utah AGRC geocoding service, you must create a developer account and obtain an API key. This key authenticates your requests and tracks your usage against the free tier or a paid plan.

  1. Navigate to the AGRC Geocoding Service Page: Visit the official Utah AGRC Address Geocoding page. This page provides an overview of the service and links to registration.

  2. Register for an Account: Look for a registration link or button, typically labeled "Sign Up" or "Get an API Key." You will likely need to provide an email address, create a password, and agree to the terms of service. Ensure you complete any email verification steps.

  3. Access Your Dashboard: After successful registration and login, you will be directed to your developer dashboard. This is where you manage your applications and API keys.

  4. Generate an API Key: Within your dashboard, locate the section for API keys or credentials. Follow the instructions to generate a new API key. This key is a unique string that you will include with every request to the AGRC geocoding API. Keep your API key secure and do not expose it in client-side code or public repositories.

The AGRC service uses API keys for authentication, a common method for controlling access to web services. For more complex authentication scenarios or when integrating with other services, understanding broader authentication patterns like OAuth 2.0 can be beneficial, as detailed in the OAuth 2.0 specification.

Your first request

Once you have your API key, you can make your first geocoding request. The AGRC Geocoding API is a RESTful service, meaning you interact with it using standard HTTP methods (GET, POST).

This example demonstrates a simple geocoding request to find the coordinates for a Utah address. Replace YOUR_API_KEY with the actual key you obtained from your AGRC dashboard.

Example: Geocoding an Address (GET Request)

The primary endpoint for geocoding an address is typically /api/v1/geocode or similar. Consult the AGRC Geocoding API documentation for the exact endpoint and required parameters.

Let's assume the endpoint is https://api.mapserv.utah.gov/api/v1/geocode/ and it expects an address parameter and an API key.

Using curl (Command Line)

This curl command sends a GET request to geocode a specific address:

curl "https://api.mapserv.utah.gov/api/v1/geocode/123%20Main%20St%20Salt%20Lake%20City%20UT?apiKey=YOUR_API_KEY"

Explanation:

  • https://api.mapserv.utah.gov/api/v1/geocode/: The base URL for the geocoding service.
  • 123%20Main%20St%20Salt%20Lake%20City%20UT: The address to geocode, URL-encoded. Spaces are replaced with %20.
  • apiKey=YOUR_API_KEY: Your unique API key appended as a query parameter.

Using Python

This Python script uses the requests library to make the same GET request:

import requests

api_key = "YOUR_API_KEY"
address = "123 Main St Salt Lake City UT"
base_url = "https://api.mapserv.utah.gov/api/v1/geocode/"

# URL-encode the address for the request
encoded_address = requests.utils.quote(address)

request_url = f"{base_url}{encoded_address}?apiKey={api_key}"

try:
    response = requests.get(request_url)
    response.raise_for_status() # Raise an exception for HTTP errors
    data = response.json()
    print("Geocoding Result:")
    print(data)
except requests.exceptions.RequestException as e:
    print(f"An error occurred: {e}")

Expected JSON Response (example structure):

The API will return a JSON object containing the geocoded results, including latitude, longitude, and potentially other address components and match scores. The exact structure can be found in the AGRC API documentation.

{
  "status": 200,
  "result": {
    "score": 100,
    "locator": "AddressPoints",
    "matchAddress": "123 MAIN ST, SALT LAKE CITY, UT",
    "location": {
      "x": -111.891018,
      "y": 40.760779
    },
    "inputAddress": "123 Main St Salt Lake City UT"
  }
}

Common next steps

After successfully making your first geocoding request, consider these common next steps to integrate the AGRC service more deeply into your applications:

  1. Explore Advanced Geocoding Parameters: The AGRC API offers various parameters to refine your geocoding queries, such as specifying different locators, return fields, or spatial references. Review the full API documentation for details on these options.

  2. Implement Reverse Geocoding: If your application requires converting coordinates back to human-readable addresses, explore the reverse geocoding capabilities of the AGRC API. This is useful for displaying locations on a map based on user clicks or GPS data.

  3. Error Handling and Rate Limits: Integrate robust error handling into your application to manage cases where addresses are not found or API limits are reached. The AGRC service includes a free tier, but exceeding 15,000 requests per month will require a paid plan. Monitor your usage and understand the AGRC pricing structure.

  4. Batch Geocoding: For applications that need to process large lists of addresses, investigate batch geocoding options. This can be more efficient than sending individual requests for each address.

  5. Integrate with Mapping Libraries: Combine the geocoded results with popular mapping libraries like Leaflet, OpenLayers, or the ArcGIS API for JavaScript to visualize locations on interactive maps. For instance, the ArcGIS API for JavaScript offers various tools for integrating geocoding services.

  6. Security Best Practices: Always keep your API key confidential. For server-side applications, store keys securely using environment variables or a secrets management service. Avoid embedding API keys directly in client-side code that could be publicly exposed.

Troubleshooting the first call

Encountering issues with your initial API call is common. Here are some troubleshooting steps:

  • Check API Key: Ensure your API key is correctly copied and included in the request. A common error is a typo or an expired key. Verify it in your AGRC account dashboard.

  • URL Encoding: Make sure the address string in your URL is properly URL-encoded. Spaces and special characters must be converted (e.g., space to %20). Most HTTP client libraries handle this automatically, but manual construction requires careful encoding.

  • Endpoint Accuracy: Double-check that the API endpoint URL you are using matches the one specified in the AGRC documentation. Endpoints can change or have specific versioning.

  • Network Connectivity: Confirm that your development environment has active internet access and is not blocked by a firewall from reaching the AGRC API server.

  • Review API Documentation: Refer to the official AGRC API documentation for specific error codes and messages. The response body often contains details about what went wrong.

  • Test with Known Good Address: Try geocoding a very simple, well-known Utah address (e.g., "100 South Main Street, Salt Lake City, UT") to rule out issues with the complexity of your test address.

  • Consult Developer Console/Logs: If using a browser, check the network tab in your browser's developer console for HTTP status codes and response bodies. For server-side code, review your application logs for any errors or exceptions.

  • Rate Limit Exceeded: If you receive a 429 "Too Many Requests" error, you may have exceeded the free tier's 15,000 requests per month. Check your usage in the AGRC dashboard or consider upgrading your plan if needed, as outlined in the AGRC pricing information.