Geocoding Extensions

Geocoding extensions operate with Manifold's geocoding engine to perform spatial operations based upon an address string or zip code. Geocoding extensions will not work unless the Manifold US street address geocoding database or a custom geocoding database is installed, or if Microsoft MapPoint has been installed. If MapPoint is installed the extensions will only work within the North American or European coverage provided by the MapPoint edition in use.

Geocoding extensions using the Manifold US streets geocoding database will not work with Manifold IMS unless the geocoding database is installed within the Manifold application installation folder (normally, C:\Program Files\Manifold System).

The following table list available geocoding functions:

Function
Comments
CloseToAddress(geom, address, distance[, unit])
Returns True if the object lies within the specified distance of the address; otherwise returns False.
CloseToZip(geom, zip, distance[, unit])
Returns True if the object lies within the specified distance of the zip code centroid; otherwise returns False.
DistanceToAddress(geom, address[, unit])
Returns the distance between the object and the address in the specified units.
DistanceToZip(geom, zip[, unit])
Returns the distance between the object and the zip code centroid in the specified units.
LocateAddress(address)
Returns the location of the address as a point.
LocateAddressLat(address)
Returns the latitude of the address.
LocateAddressLon(address)
Returns the longitude of the address.
LocateZip(zip)
Returns the location of the zip code centroid as a point.
LocateZipLat(zip)
Returns the latitude of the zip code centroid.
LocateZipLon(zip)
Returns the longitude of the zip code centroid.

Remarks

Geom
arguments are either geometric objects of type Geometry or are object IDs. The address and zip arguments are strings.

If an object is a line or an area the object's centroid is used for distance calculations.

If an address string produces more than one match, the system automatically selects the closest of the building-level matches (possibly with an "unknown street name, possible misspelling" error). If an address string produces no building-level matches, CloseToAddress returns False, DistanceToAddress returns -1 and LocateAddressLat and LocateAddressLon return 0.

If a zip code string is invalid (no matches in the geocoding database) CloseToZip returns False, DistanceToZip returns -1 and LocateZipLat and LocateZipLon return 0.

If the optional distance unit is omitted, the system will use the native measurement unit of the drawing or meters if the drawing is not projected. See the Appendices - Tables - Units topic for a list of standard units.

Distances are great circle distances computed over a WGS84 ellipsoid and are accurate to 1 meter.

The geocoding functions cache returned geocoding data between subsequent calls. This means that a LocateAddressLat followed by a LocateAddressLon runs a geocoder search only once on the address.

Functions can be used from IMS as long as the geocoding database is located within the Manifold application installation folder (usually C:\Program Files\Manifold System). To keep the user interface simple and to avoid the complication of dealing with possible user errors when entering address information into forms, many web applications with IMS will use the CloseToZip or DistanceToZip functions since these require the user to merely enter the ZIP code correctly. For many applications, such as locating a dealer, finding the closest objects to the ZIP centroid provides acceptable accuracy.

Examples

For the examples below, suppose we have two drawings called "Clients" and "Dealers" that contain point objects and the "Clients" drawing that contains a zip code column.

This example uses the CloseToAddress function to locate all dealers within 10 miles of 330 Lytton Ave, Palo Alto:

SELECT * FROM [Dealers] WHERE CloseToAddress([ID], "330 Lytton Ave, Palo Alto, CA, 94301", 10, "mi");

This example uses the CloseToZip function to select all dealers within 10 miles of the centroid for the 89701 zip code:

SELECT * FROM [Dealers] WHERE CloseToZip([ID], "89701", 10, "mi");

This example uses the DistanceToZip function to select all dealers within 5 to 15 miles of the centroid for the 89701 zip code:

SELECT * FROM [Dealers] WHERE DistanceToZip([ID], "89701", "mi") BETWEEN 5 AND 15;

This example uses the LocateZipLat and LocateZipLon functions to output a lat/lon location for the zip code centroid of each client:

SELECT [Name], LocateZipLat([Zip]) AS [Latitude], LocateZipLon([Zip]) AS [Longitude] FROM [Clients];

See Also

Street Address Geocoding

Selecting Objects with Queries

Using SQL to Select Map Objects

Spatial Extensions

Back to Manifold Home Page