Using reverse geocoding

Reverse geocoding is an optional, licensed feature, which takes input geocodes and returns possible addresses, segment IDs, and block IDs.

For example, entering the following information in Geotest using the nearest address processing option:

Longitude:   -105239771

Latitude:   40018912
Search Distance:   150 feet

results in the following output:

4750 WALNUT STBOULDER,

CO 80301-2538
MatchCode = NS0
LocCode = AS0
Lon = -105239773
Lat = 40018911
Distances: Search = 150 Offset = 50 squeeze = 50 Nearest = 50.0 Pct Geocode = 94.0
SegID = 472881795
PtID = TomTom
Block = 080130122032066
County Name = BOULDER COUNTY
DPBC = 50

Although many of the GeoStan outputs apply to reverse geocoding searches, several outputs are unavailable such as LACSLink conversion and unit numbers. GeoStan returns these outputs as blank. GeoStan also has outputs specific to reverse geocoding searches.

If multiple street segments are equally close to the input location, GeoStan returns a status indicating multiple candidates for a match so you can determine which segment is the appropriate match.

Note: The information GeoStan returns contains an approximate address based on the geocode you input. This approximate address may not exist or may not accept mail delivery.

See the following sections for more information on reverse geocoding:

Note: Reverse geocoding is not available on z/OS.
Note: Reverse geocoding is currently not available for Guam.

Preparing for processing geocodes with GeoStan

Before processing geocodes, follow the steps below to ensure proper geocoding:

  1. Verify your input list

    Although your input list can contain geocode information as well as address information, GeoStan tries to match to either the geocode or the address information; not both. GeoStan returns an error if you try to match to both the geocode and the address information.

    Your input list should contain longitude and latitude points in millionths of decimal degrees.

  2. Pass the geocode in GeoStan using the longitude and latitude enums with the data set function.

  3. Set the SPATIAL_QUERY init property to True to open the spatial query files.

  4. Set your processing options.

When processing a geocode through GeoStan you can set the following processing options using the data set and find functions:

Option

Description

Offset Distance

Sets the offset distance from the street segment.

squeeze Distance

Set the distance to offset the first and last address-level geocodes from the street ends.

Search Distance

Sets the radius in which GeoStan searches for a match to the input geocode.

Searchable Address Types

Sets the type of match candidates that you allow GeoStan to match against. This can include intersections, addresses interpolated on street segments, street segments with no number range, and point data locations.

Reverse geocoding to points matching

Sets matching to the nearest point address that is within the specified Search Distance, rather than to the closest feature (e.g. street segment or intersection as well as point addresses).

Understanding how GeoStan processes reverse geocodes

GeoStan processes geocodes in the following order:

  1. GeoStan defines a rectangle based on your input geocode and search distance.

  2. GeoStan computes the distance between each street segment and the input location.

  3. If one segment is closest, GeoStan finds the offset and interpolated percentage and the street side. It then computes an approximate house number based on this information.

    If there is more than one segment that is equally close to the input location, a multi-match occurs. GeoStan returns the information for all of the equally close segments so that you can determine which segment is applicable.

  4. GeoStan returns the address information, including the segment range, the approximate house number, and the parity of the range along with other standard address information.

Note: Although many of the standard address matching outputs apply to the reverse geocoding option, several outputs are unavailable (such as LACSLink conversion and unit numbers). GeoStan returns these outputs as blank. GeoStan also has outputs specific to reverse geocode processing, such as specific match codes and the distance from the input location to the matched segment.

Reverse geocode matching sample code

The following is a code sample for matching an address using the C functions of GeoStan.
char matchcode[GS_MATCH_CODE_LENGTH];
char outaddr[GS_ADDRLINE_LENGTH];
char lastline[GS_LASTLINE_LENGTH];
char pct[GS_PERCENT_GEOCODE_LENGTH];
char nearestdist[GS_NEAREST_DIST_LENGTH];
GsClear(gs);
GsDataSet(gs,GS_LON,"-105239771");
GsDataSet(gs,GS_LAT,"40018912");
GsDataSet(gs,GS_OFFSET_DIST,"5");
GsDataSet(gs,GS_SQUEEZE_DIST, "50");
if(GsFind(gs,GS_NEAREST_ADDRESS)==GS_SUCCESS)
{
GsDataGet(gs,GS_OUTPUT,GS_MATCH_CODE,matchcode,sizeof(matchcode));
GsDataGet(gs,GS_OUTPUT,GS_ADDRLINE,outaddr,sizeof(outaddr));
GsDataGet(gs,GS_OUTPUT,GS_LASTLINE,lastline,sizeof(lastline));
GsDataGet(gs,GS_OUTPUT,GS_PERCENT_GEOCODE,pct,sizeof(pct));
GsDataGet(gs,GS_OUTPUT,GS_NEAREST_DIST,nearestdist,sizeof(nearestdist));
}

Using reverse geocoding to points matching

The reverse geocoding to points matching feature provides the option to match to the nearest point address within the search radius, rather than to the closest feature (e.g. street segment or intersection as well as point addresses).

Note: This feature requires that at least one points data set and one streets data set are loaded; otherwise, the match will be made to the closest feature.

To enable reverse geocoding to points matching, use the following:

C

Use GS_FIND_CLOSEST_POINT in the find properties of GsFindWithProps.

COBOL

Use GS-FIND-CLOSEST-POINT in the find property options for GSFINDWP.

JAVA

Use FIND_CLOSEST_POINT in the find properties of FindProps.

.NET

Use GS_FIND_CLOSEST_POINT in the find properties of FindProps.