How to programatically create an address field I would like to use the address field module in my module.  How do I create an address field and an instance for that field.  I haven't found any code in the module that defines what the array structure should look like.

I found this code in the commerce module (under modules/customer/commerce_customer.module):

if (empty($field)) {
  $field = array(
    'field_name' =&gt; $field_name,
    'type' =&gt; 'addressfield',
    'cardinality' =&gt; 1,
    'entity_types' =&gt; array('commerce_customer_profile'),
    'translatable' =&gt; FALSE,
  );

  $field = field_create_field($field);
}

if (empty($instance)) {
  $instance = array(
    'field_name' =&gt; $field_name,
    'entity_type' =&gt; 'commerce_customer_profile',
    'bundle' =&gt; $profile_type['type'],
    'label' =&gt; t('Address'),
    'required' =&gt; TRUE,
    'widget' =&gt; array(
      'type' =&gt; 'addressfield_standard',
      'weight' =&gt; -10,
      'settings' =&gt; array(
        'format_handlers' =&gt; array('address', 'name-oneline'),
      ),
    ),
    'display' =&gt; array(),
  );


I can modify that to meet my needs, if someone is familiar with this module and could point out some attributes that may be missing, I'll accept their response as an answer to this question.

Update The address that I'm importing may contain up to 6 lines for the street address (all for one location) as defined by RETS.  Is it possible to store a street address this long in an address field?  If not I can concatenate the extra addresses into the second address line.
I had a similar question these days, and I tried to see if the Features module could help. Features worked to me.

You can create the field by the UI and then export a feature with the address field already created.
After that you can move the inc files for your custom module and add an include on your .module file:

include_once('[your_module].features.inc');


Then, you will need to add the some lines on your .info from the info file of the exported feature.

Your info file will need something like this:

dependencies[] = "features"    
dependencies[] = "text"

features[field][] = "node-article-field_address"


This question may help you too: Develop a module that adds a new content type with custom fields.