Geocoding Documentation
    • Dark
      Light
    • PDF

    Geocoding Documentation

    • Dark
      Light
    • PDF

    Article summary

    Purpose

    The LightBox Geocoding API provides access to users interested in matching addresses to geographic locations. Geocoding is performed by using the Geocoding API with the full address, a partial address or a set of parsed address fields. The geocoding API also provides type-ahead or auto-complete capability.

    Swagger: OAS 3.1 Specification

    Requirements

    The LightBox APIs are hosted in the cloud and therefore have no platform requirements. Application requirements include:
    • A network connection to the LightBox API server
    • Ability to parse JavaScript Object Notation (JSON) API responses
    • Secure HTTPS connection
    • LightBox authentication key
    • LightBox authentication key

    Connecting your account

    When your LightBox user account is created, a unique API key is also generated. The API key should be kept secret at all times and can only be used for API requests. The key is required in all API calls.

    To retrieve your unique API key:

    • Log in to the LightBox Developer Portal 
    • Select Apps from the menu bar
    • In your approved App, note your API key (under Consumer Key)

    Performing API requests

    All API requests must be made over secure HTTPS connections. Requests made over HTTP will fail.

    The base URL of the API server that all API requests will be made to is: https://api.lightboxre.com/ followed by a version number https://api.lightboxre.com/v1

    Authentication

    LightBox APIs uses a token-based authentication. All requests to the LightBox APIs must be authenticated. The token to be passed via an HTTP header with key 'x-api-key' and value <Your authentication token>

    Pass your unique API key in the authorization header of every LightBox API call.  LightBox uses this information to authenticate your identify and determine whether you have sufficient permissions to complete the operation. curl -X GET -H ‘x-api-key: (api_key)’  https://api.lightboxre.com/

    API Requests

    Search

    Return an address based on the full-text string 'text,' where each result includes a representative point for the address and references to related parcels, structures, or assessment. If there is no exact match, this will return the best possible match. 

    GET /addresses/search

    Example requests

    Single Address String

    curl -X GET -H ‘x-api-key: (api_key)’ https://api.lightboxre.com/v1/addresses/search?text=25481 Buckwood, Lake Forest, CA

    https://api.lightboxre.com/v1/addresses/search?text=25481 Buckwood, Lake Forest, Ca

    Parsed Address Parameters

    curl -X GET -H ‘x-api-key: (api_key)’ https://api.lightboxre.com/v1/addresses/search?streetNumber=3840&streetName=w 213th&locality=fairview park&region=ohio&country=US&postalCode=44126

    https://api.lightboxre.com/v1/addresses/search?streetNumber=3840&streetName=w 213th&locality=fairview park®&region=ohio&country=US&postalCode=44126

    Parameters

    ParameterTypeDescriptionUsage
    textqueryFull or partial address string for matching. Required if the parsed fields are not being used.optional (Note either text or the parsed fields below are required)
    streetNumberqueryStreet number of address. (Parsed field parameter)
    optional
    streetNamequeryStreet name along with street type and direction. (Parsed field parameter)
    optional
    unitqueryUnit number of address. (Parsed field parameter)
    optional
    localityqueryName of a locality/city, (Parsed field parameter)
    optional
    regionqueryName of a region/state/province. (Parsed field parameter)
    optional
    postalCodequeryName of a postal code or zip code. (Parsed field parameter)
    optional
    countryqueryName of a country. (Parsed field parameter)
    optional
    bboxqueryA bounding box expressed in the NAD83 projected coordinate system. The bounding box will be used to provide a hint to the geocoding engine to look within the bounding box first for results first. example "-83.0434660625,40.0198659375,-83.04070793749999,40.0226240625"
    optional

    Response

    Media type: application/json

    Autocomplete / Type Ahead

    Return a set of address candidates based on autocompletion of the partial string 'text,' where each result includes a representative point for the address and references to related core objects, parcels, addresses, assessments, and structures.

    GET /addresses/_autocomplete

    Example requests

    curl -X GET -H ‘x-api-key: (api_key)’ https://api.lightboxre.com/v1/addresses/_autocomplete?text=25481 Buckwood

    https://api.lightboxre.com/v1/addresses/_autocomplete?text=25481 Buckwood

    Parameters

    ParameterTypeDescriptionUsage
    textqueryPartial address string for autocompletion.required
    countryCodequeryOptional parameter to limit the requests to a specific countryoptional
    bboxqueryA bounding box expressed in the NAD83 projected coordinate system. The bounding box will be used to provide a hint to the geocoding engine to look within the bounding box first for results first. example "-83.0434660625,40.0198659375,-83.04070793749999,40.0226240625"
    optional

    Response

    Media type: application/json

    Reverse Geocode

    Return address records based on Point WKT (Well Known Text) string. 

    Note: Supports both US and Canadian addresses

    Examples:

    • POINT(-122.40317865990883 45.585729937697515)

    GET /addresses/reverse

    Example requests

    curl -X GET -H ‘x-api-key: (api_key)’ https://api.lightboxre.com/v1/addresses/reverse?wkt=POINT%28-117.852723%2033.63799%29&bufferDistance=50&bufferUnit=m

    https://api.lightboxre.com/v1/addresses/reverse?wkt=POINT%28-117.852723%2033.63799%29&bufferDistance=50&bufferUnit=m

    Parameters

    ParameterTypeDescriptionUsage
    wktqueryThe geometry of the location expressed in WKT format.required
    bufferDistancequeryBuffer distance expressed in 'bufferUnits'.optional
    bufferUnitqueryThe unit type to apply to the buffer (e.g., m, km, ft, mi)optional
    limitqueryA number indecating how many records you would like returned when using nearest. Default = 1, Max 40optional

    Response

    Media type: application/json

    API Response

    {
      "$ref": "string",
      "$metadata": {
        "geogcs": {
          "epsg": "4326"
        },
        "recordSet": {
          "totalRecords": 99,
          "bbox": {
            "xMax": -105.250409,
            "xMin": -105.251916,
            "yMax": 40.023629,
            "yMin": 40.022576
          }
        }
      },
      "addresses": [
        {
          "$ref": "string",
          "id": "string",
          "$metadata": {
            "geocode": {
              "confidence": {
                    "streetNumber": 1,
                    "streetName": 1,
                    "locality": 1,
                    "postalCode": 1,
                    "score": 1
                  },
              "changeFlag": {
                "streetName": "Fuzzy",
                "streetType": "Added",
                "locality": "Changed",
                "postalCode": "Removed"
              },
              "addressComponents": {
                "prefixDirection": "string",
                "prefixType": "string",
                "streetNumber": "string",
                "streetName": "string",
                "suffixType": "string",
                "suffixDirection": "string",
                "unit": "string"
              },
              "aliases": [
                {
                  "prefixType": null,
                  "prefixDirection": null,
                  "streetNumber": "4007",
                  "streetName": "AR-10",
                  "suffixType": null,
                  "suffixDirection": null,
                  "unit": null
                 }
               ]                      
              "precisionCode": "10"
            }
          },
          "label": "string",
          "location": {
            "streetAddress": "string",
            "locality": "string",
            "regionCode": "AL",
            "postalCode": "string",
            "postalCodeExt": "string",
            "countryCode": "US",
            "representativePoint": {
              "longitude": 0,
              "latitude": 0,
              "geometry": {
                "wkt": "string"
              }
            }
          },
          "parcels": [
            {
              "$ref": "string",
              "id": "string"
            }
          ],
          "structures": [
            {
              "$ref": "string",
              "id": "string"
            }
          ],
          "assessments": [
            {
              "$ref": "string",
              "id": "string"
            }
          ]
        }
      ]
    }

    Field Dictionary

    FieldTypeDescription



    HTTP Error Codes

    HTTP Response status codes along with a brief summary of their commonly accepted usage. These status codes are returned by LightBox APIs for each request:
    200
    The request succeeded.
    201
    The object was created successfully
    202Accepted, no content
    204Successful, no content
    204
    The server has successfully fulfilled the request and that there is no additional content to send in the response payload body. Typically returned on a DELETE
    400
    One or more of the request parameters were invalid.
    401
    The client must authenticate itself to get the requested response. Note: This could also be due to your trial key has expired.
    404
    The server cannot find the requested resource. This can also mean that the endpoint is valid but the resource itself does not exist.
    429
    Too many requests were made in a short period of time, or you have exceeded your request-lot pool.
    500
    The server has encountered an error it does not know how to handle.
    503Service Unavailable.



    Interpreting the Result

    Change Flag

    Change flag provides information about the matched address and how it differs from the input address. There are four parts of the address that are reported on: street name, street type, locality, and postal code. 

    Change Flag ValueDescription
    FuzzyThe value was close but not exact
    AddedThe value was not included in the input address and was added to find a match address
    ChangedThe value that was passed in was changed to a new value
    RemovedThe value was not found on the matched address so it was removed
    AliasThe value is an alias of a matched address

    Confidence Score

    Our API results include a confidence score, which indicates the likelihood that the address that was input was accurately matched to the correct location. High-quality input addresses are easily parsed and matched and have a high confidence score. Low-quality input addresses, such as those with significant misspellings, numerous incorrect values, conflicting values, and other issues can be parsed and matched in most cases, but the confidence score may be lower. The confidence score will have a value from 0 to 1 with 1 being the highest confidence and 0 being the lowest confidence score. 

    The confidence object within the result will contain a separate score for streetNumber, streetName, locality, postalCode, and a combined score called score. Typically, looking at the score value is enough to determine if the address that was matched to is the correct address, but your business logic might use the individual scores depending on your workflow.

    Pro Tip:
    We have found that if the confidence score is > .80 the match is a good match. Depending on your use case, you might want to raise that number to .85 or even .90


    Example: 15 Allstate Pkwy, Markham, ON, L3R 5B4. This is a complete and perfectly parsed address that can be matched to an exact location. Entering this address in the LightBox Geocoding API returns a result with no changes and a perfect confidence score. We will examine two variations of this address below. 

    Variation One: 15 Allstate St, Toronto, ON. This lacks the postal code and also contains two errors: 'street' instead of 'pkwy' and 'Toronto' instead of 'Markham.' The result would have a high, but imperfect, confidence score. 

    Variation Two: 15 Allstate St, Markham Toronto, ON. This contains the errors above and an additional error—two cities. This address is not a perfect match for any existing address and could match several similar addresses in both Markham and Toronto, so the confidence score of the result will be the lowest of the three examples.

    Aliases

    If the address has alternate names they will be returend undre Aliases. This is represented as an array as there can be many aliases assigned to an address. If there are no aliases then this object is returned as null.

    Precision Code

    Precision code is a vital piece of metadata returned by the LightBox Geocoder. The precision code represents the geo-precision of the returned latitude, longitude, and WKT geometry. The table below will explain the different codes and their descriptions.  

    Precision CodeDescription
    10Centroid of Building Footprint
    11Building Main Entrance
    12Building Driveway
    15Centroid of a Group of Buildings
    20Parcel Centroid
    21Inside of Parcel
    22Along Parcel Front Line
    30Undefined Point Level Coordinates
    50Street Segment and Range Interpolation
    55Street Segment and Range Extrapolation
    60Additional Geocoding Options (includes intersections and highway ramps)
    65LDU (Local Delivery Unit, 6-character postal code) Centroid
    70Landmark
    71FSA (Forward Sortation Area, first 3 characters of postal code) Centroid
    77Centroid of Neighborhood Boundary
    78Centroid of Community Boundary
    79PPN (Populated Place Name) Centroid
    80Centroid of Municipal Boundary

    Address Components

    These values represent the address components of the matched address.



    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.