Reference Guide
Melissa’s Geocoder Object is a compliment to the Address Object. For users of Address Object, after you have verified and corrected your addresses, use this Geocoder Object to append geocoding coordinates, census information, school information, and more. Geocoder covers both the United States and Canada, perfectly mirroring the coverage of Address Object. For Global Geocoding coverage outside of the US and Canada, take a look at our Global Address Object.
The GeoCoder Object uses WGS 84 standard, an Earth-centered, Earth-fixed terrestrial reference system and geodetic datum.
Census data changes and updates are made on a regular basis. It is important to know the year of the Census data Melissa is returning so that it can be accurately matched up to your own data or other census values.
The GeoCoder Object has the following system requirements:
Hardware | Detail |
---|---|
HDD | 1GB Hard Disk Space |
Operating System | Details |
---|---|
Windows | Windows 7 or later personal computer OS version. Windows Server 2008 R2 or later Windows Server version. |
Linux | Linux distribution supporting GCC 3.3 or GCC 4.1. |
Solaris | Solaris 8.0 and newer supporting Workshop6 compiler or Workshop 12. |
AIX | AIX 5.2 supporting XLC6 and AIX 7 supporting GCC 8.3 |
HP-UX | Version 11 or later supporting ACC3 or GCC 3.4 |
Operating System | Install File Name |
---|---|
Windows | setup.exe |
Unix | setup.sh |
Melissa requires a License Key to access the full features of GeoCoder Object. Your License Key will be sent to you from your Melissa representative. Without the License Key, GeoCoder Object will not run.
Your license key will determine what functionality you have access to and your valid subscription dates are. Once a license key expires, your application using GeoCoder Object will no longer work. This is why it is important to make sure you keep your license up to date. Your Melissa representative will work with you closely to make sure you have time to renew your subscription and update your license.
Use GeoCoder Object to add geographic coordinate data to your addresses, segment and enhance your target marketing with official census information, plus append information like school districts.
GeoCoder Obejct's data set is updated quarterly.
Make sure to first set up the GeoCoder Object before you continue below.
To use the GeoCoder Object, we've grouped the functions in order of use. Follow the steps below to use GeoCoder Object:
The rest of this document will walk you through these different steps and expand on their implementation and use.
Melissa makes up to three different sets of Census data available. The regular census output fields like CensusFIPS
, CensusTrack
, CensusBlock
return the laest census data available. This is typically the latest ACS data.
You can also access the 2010 and 2020 CensusKeys (which are the concatenated fips, track and block values) using CensusKey2010
and CensusKey2020
.
Prepare Geocoder Object for use by pointing it to the location of your data files and setting your license. Initiazation is a resource intensive process, but only needs to be done once per instance. After an object is Initialized, it can continue to process inputs continually.
You have to first instantiate the GeoCoder Interface in your application code.
You can set your license in two ways:
Once you've set your license, set the data file path with SetPathToGeoPointDataFiles
. There is a single data file for GeoCoder Object: mdGeoCode.db3.
SetPathToGeoPointDataFiles
Once you set the data file path you need to initialize and load it to ensure everything is working. Call InitializeDataFiles
. If it returns anything other than 0 the initialization has failed and you need to check the return value of GetInitializeErrorString
to find out why it failed. It's important to do this step since the data file is integral to the functionality of GeoCoder Object.
InitializeDataFiles
GetInitializeErrorString
Time is an eternal constant, so things will get old and expire... like your data file. If you want GeoCoder Object to work, be sure to use these methods to check the dates of the database and the build number of the object.
GetBuildNumber
GetDatabaseDate
GetExpirationDate
GetLicenseExpirationDate
//Initialize GeoCoder Interface
SET addPtr = NEW instance of GeoCoder
//Set Data File path
CALL SetPathToGeoPointDataFiles WITH DataPath
//Initialize Data File and check for errors
CALL InitializeDataFiles RETURNING result
IF result <> 0 THEN
CALL GetInitializeErrorString RETURN ErrorMessage
DISPLAY ErrorMessage
ELSE
GeoCode Addresses
END IF
The environment variable method of setting the license will override the value entered into SetLicenseString()
via code. The environment variable method is the recommended method as it can be easily changed without re-compiling. When your current subscription expires and you renew, you will be issued a new license string.
The GeoCoder Object data file is updated quarterly and you'll need at least 20GB of Hard Disk space for this file.
There were. Now there aren't. The new, improved and single data file is mdGeoCode.db3
. This also means the SetPathToGeoCanadaDataFiles
method has been deprecated. See the Deprecated section in the Appendix.
Make sure you call the GET database date methods AFTER you initialize the data file and told the object where to find the data files. Otherwise you'll get crazy dates that help absolutely no one... like 1969 or 1899.
This method sets the input data in key-value pairs, in preparation for the FindGeo
method.
SetInputParameter
All attributes can be set at the same time. The object will do lookups in a top-down order, following the order of the key strings from most significant to least (First MAK, then AddressKey, followed by Zip, etc.)
The available key strings are ordered below, from most significant to least:
Significance | Key String | Desscription |
---|---|---|
1 | MAK | A proprietary Melissa unique key identifier for an address. This is derived from Address Checking. |
2 | Zip | The 5-digit postal code. You would set this for addresses that do not verify and therefore do not have a MAK number. You cannot get rooftop level geocoding but can still get Zip or Zip+4 level geocoding if you set this value. |
3 | Plus4 | The 4-digit plus4 of the postal code. You would set this for addresses that do not verify and therefore do not have a MAK number. You cannot get rooftop level geocoding but can still get Zip or Zip+4 level geocoding if you set this value. |
* | AddressKey | An 11 digit key of the property. Based on the Zip5, Plus4 and two digit delivery code. *This is deprecated and for users who only have addresskey. |
//Set the Input data
IF MAK is provided
CALL SetInputParameter WITH MAK, makValue
CALL SetInputParameter WITH Zip, ZipValue
IF Plus4 is provided
CALL SetInputParameter WITH Plus4, Plus4Value
These methods retrieve the geographic data for multiple attributes. The main method you'll use here is FindGeo
after your MAK, Zip and Plus4 inputs are set. Other methods are provided under Compute Methods for more specific use cases.
FindGeo
This method performs a lookup on the input data. Even though it's simple, it'll be your daily driver so get used to it.
//GeoCode the input data
CALL FindGeo
GetResults
This returns a comma-delimited string of four-character codes that detail the status and any errors for the current record. For a general primer on Result Codes, please visit: Quickstart Result Codes.
For a list of all possible codes, visit: Melissa GeoCoder Object Wiki - Result Code Details
GetResultCodeDescription
This method returns a description of the input result code. It requires two values, a result code and an enumerated option. The options are as follows:
ResultCodeDescriptionLong
- Returns a detailed description of the input result code.ResultCodeDescriptionShort
- Returns a short description of the input result code.For Example:
GS01, GE04, GW01
IF ResultsCode CONTAINS "GS01", "GS02", "GS03", "GS05", OR "GS06" THEN
{
//Handle GeoCoded Data
}
ELSE
{
//Return result code
}
If a string of result codes are sent to GetResultCodeDescription
, only the first result code will be used.
GetOutputParameter
This returns the requested element geocoded by FindGeo
. The available element strings are listed below. This method must be called after FindGeo
.
Element String | Description |
---|---|
BlockSuffix |
If the CensusKey is 15-characters, this will be empty. If the CensusKey is 16-characters, the last character is the BlockSuffix. |
CBSACode |
5-digit code for the CBSA. |
CBSATitle |
Title for the CBSA, if any. |
CBSALevel |
Level (metropolitan or micropolitan) of the CBSA, if any. |
CBSADivisionCode |
Code for the CBSA division, if any. |
CBSADivisionTitle |
Title for the CBSA division, if any. |
CBSADivisionLevel |
Division Level (metropolitan or micropolitan) of the CBSA division, if any. |
CensusBlock |
Census Block as defined by the U.S. Census Bureau. |
CensusKey |
The latest available 15-digit string containing the concatenated County FIPS, Census Tract and Census Block. |
CensusKeyDecennial |
15-digit string containing the concatenated County FIPS, Census Tract, and Census Block for the most recent Decennial Census. The Decennial Census occurs every 10 years with the most recent available being 2010. The CensusKey of the latest Decennial census value. Will change once a new decennial census is available. |
CensusKey2010 |
CensusKey for the 2010 Decennial Census. |
CensusKey2020 |
CensusKey for the 2020 Decennial Census. |
CensusTract |
Census Tract as defined by the U.S. Census Bureau. |
CountyFips |
5-digit numeric Federal Information Processing Standard (FIPS) code. |
CountyName |
The name of the county. |
CountySubdivisionCode |
5-digit string representing the County Subdivision Code. |
CountySubdivisionName |
The County Subdivision Name. |
ElementarySchoolDistrictCode |
5-digit string representing the Elementary School District Code. |
ElementarySchoolDistrictName |
The Elementary School District Name. |
Latitude |
The latitude in degrees. |
Longitude |
The longitude in degrees. |
PlaceCode |
The area code located outside of a city but within the ZIP Code. |
PlaceName |
The area name located outside of a city but within the ZIP Code. |
Results |
Comma delimited status, error codes, and change codes. |
SecondarySchoolDistrictCode |
5-digit string representing the Secondary School District Code. |
SecondarySchoolDistrictName |
The Secondary School District Name. |
StateDistrictLower |
3-digit string representing the Lower State District Code. |
StateDistrictUpper |
3-digit string representing the Upper State District Code. |
TimeZone |
The Time Zone name. |
TimeZoneCode |
3-letter string representing the Time Zone Code. |
UnifiedSchoolDistrictCode |
5-digit string representing the Unified School District Code. |
UnifiedSchoolDistrictName |
The Secondary Unified District Name. |
//Handling GeoCoded Data
CALL GetOutputParameter(CountyName) RETURNING CountyName
CALL GetOutputParameter(CountyFIPSCode) RETURNING CountyFIPSCode
CALL GetOutputParameter(CensusBlock) RETURNING CensusBlock
CALL GetOutputParameter(CensusTract) RETURNING CensusTract
CALL GetOutputParameter(Latitude) RETURNING Latitude
CALL GetOutputParameter(Longitude) RETURNING Longitude
CALL GetOutputParameter(PlaceCode) RETURNING PlaceCode
CALL GetOutputParameter(PlaceName) RETURNING PlaceName
CALL GetOutputParameter(CBSACode) RETURNING CBSACode
CALL GetOutputParameter(CBSALevel) RETURNING CBSALevel
CALL GetOutputParameter(CBSATitle) RETURNING CBSATitle
CALL GetOutputParameter(CBSADivisionCode) RETURNING CBSADivisionCode
CALL GetOutputParameter(CBSADivisionLevel) RETURNING CBSADivisionLevel
CALL GetOutputParameter(CBSADivisionTitle) RETURNING CBSADivisionTitle
CALL GetOutputParameter(TimeZone) RETURNING TimeZone
CALL GetOutputParameter(TimeZoneCode) RETURNING TimeZoneCode
If GetOutputParameter
returns an empty string, it means you didn't first call FindGeo
. Go back, call FindGeo
first, then try this again.
In order to provide detailed and up to date geocoding information to you at an affordable price, we are obligated to log royalties for our data providers in certain scenarios:
For smaller subscription levels, we are required to turn on internet logging. The Geocoder Object will reach out to Melissa servers for authentication and log the number of records processed. We have built mechanisms to reduce internet traffic, handle intermittent outages, while maintaining our royalty obligations. If Geocoder Object fails to initialize but was working without any changes, it is likely that it is due to a failure to communicate with Melissa servers. If this happens, please check your network and firewall allows internet access to our API.
For Medium subscription levels, we do not require internet logging but will still need quarterly royalty reports from the client. The client can product their own usage reports, or use these methods to assist in generating usage data:
SetLatitude
SetLongitude
WriteToLogFile
The SetLatitude
or SetLongitude
functions will prevent records previously coded with GeoCoder Object from being counted towards your overall usage. Any addresses with previously geocoded values that match these properties won't be counted against your total usage.
For Enterprise subscriptions we do not require any royalty reporting.
You have to call the WriteToLogFile
method before the InitializeDataFiles
method. You also need a valid path or the log file will be made in the current directory of the program.
CustomerID|YYYY-MM-DD hh:mm:ss|GS01 Count|GS02 Count|GS05 Count|GS06 Count|CheckSum
These methods can be used with the latitude and longitude returned from GetOutputParameter
to calculate distances and bearing between two records.
Both methods have the same input parameters (double-precision floating point numbers):
lat1
- Latitude for point 1 in degrees, 90 to -90.long1
- Longitude for point 1 in degrees, 180 to -180.lat2
- Latitude for point 2 in degrees, 90 to -90.long2
- Longitude for point 2 in degrees, 180 to -180.ComputeBearing
This method returns a bearing of 0 to 360 degrees representing the compass direction from point 1 to point 2.
North is 0 degrees, East is 90, South is 180, and West is 270.
ComputeDistance
This method returns the distance (in miles) between two points based on the given latitudes and longitudes.
If you enter an invalid latitude or longitude into ComputeBearing
OR ComputeDistance
, a value of 999 will be returned. So don't get confused!
While using ComputeBearing
, if you need to convert your bearing to an approximate compass direction, use the following table:
Direction | Degrees |
---|---|
N | 0 to 22.5, 337.5 to 0 |
NE | 22.5 to 67.5 |
E | 67.5 to 112.5 |
SE | 112.5 to 157.5 |
S | 157.5 to 202.5 |
SW | 202.5 to 247.5 |
W | 247.5 to 292.5 |
NW | 292.5 to 337.5 |
These are common words you'll see when dealing with GeoCoder Object.
These methods have been deprecated and you should not use them. We are keeping them here just so you know what's up. But don't use them. You've been warned.
These methods have been deprecated now that GeoCoder has combined all the data files into one and now uses InitializeDataFiles
.
Initialize
SetPathToGeoCanadaDataFiles
SetPathToGeoPointDataFiles
These methods have been deprecated in favor of using FindGeo
.
GeoCode
GetPoint
This method has been deprecated in favor of using GetResults
.
GetErrorCode
GetStatusCode
These are additional outputs available in the object that have been deprecated in favor of using GetOutputParameter
. They aren't needed anymore, but are here for backwards compatibility.
GetCBSACode
GetCBSADivisionCode
GetCBSADivisionLevel
GetCBSADivisionTitle
GetCBSALevel
GetCBSATitle
GetCensusBlock
GetCensusTract
GetCountyFips
GetCountyName
GetLatitude
GetLongitude
GetPlaceCode
GetPlaceName
GetTimeZone
GetTimeZoneCode