title: Programmatically/Manually create a MKPlacemark/CLPlacemark
body: <p><strong>Problem</strong></p>
  
  <p>I have a set of placemark information (country, city, etc) and a Lat/Lon pair.  I would like to use this to create an MKPlacemark object.  </p>
  
  <hr>
  
  <p><strong>Discussion</strong></p>
  
  <p>It appears that this class can only be created by </p>
  
  <pre><code>- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate addressDictionary:(NSDictionary *)addressDictionary
  </code></pre>
  
  <p>whose docs state states</p>
  
  <blockquote>
    <p>You can create placemark objects manually for entities for which you already have address information, such as contacts in the Address Book. Creating a placemark object explicitly avoids the need to query the reverse geocoder object for the same information.</p>
  </blockquote>
  
  <p>Perfect!  I have already reverse-geocoded and wish to avoid such a query.  What can I add to the dictionary?</p>
  
  <blockquote>
    <p>For a list of strings that you can use for the keys of this dictionary, see the “Address Property” constants in ABPerson Reference. All of the keys in should be at the top level of the dictionary.</p>
  </blockquote>
  
  <p>Which shows relevant keys</p>
  
  <pre><code>const ABPropertyID kABPersonAddressProperty;
  const CFStringRef kABPersonAddressStreetKey;
  const CFStringRef kABPersonAddressCityKey;
  const CFStringRef kABPersonAddressStateKey;
  const CFStringRef kABPersonAddressZIPKey;
  const CFStringRef kABPersonAddressCountryKey;
  const CFStringRef kABPersonAddressCountryCodeKey;
  </code></pre>
  
  <p>This falls quite short of the base traits for an MKPlacemark:</p>
  
  <blockquote>
    <p>Accessing the Location Data</p>
  </blockquote>
  
  <ul>
  <li>location  property</li>
  </ul>
  
  <blockquote>
    <p>Accessing the Placemark Attributes</p>
  </blockquote>
  
  <ul>
  <li>name  property</li>
  <li>addressDictionary  property</li>
  <li>ISOcountryCode  property</li>
  <li>country  property</li>
  <li>postalCode  property</li>
  <li>administrativeArea  property</li>
  <li>subAdministrativeArea  property</li>
  <li>locality  property</li>
  <li>subLocality  property</li>
  <li>thoroughfare  property</li>
  <li>subThoroughfare  property</li>
  <li>region  property</li>
  </ul>
  
  <blockquote>
    <p>Accessing Geographic Information</p>
  </blockquote>
  
  <ul>
  <li>inlandWater  property</li>
  <li>ocean  property</li>
  </ul>
  
  <blockquote>
    <p>Accessing Landmark Information</p>
  </blockquote>
  
  <ul>
  <li>areasOfInterest  property</li>
  </ul>
  
  <p>Fortunately, the actual header file for MKPlacemark's superclass says something about the address dictionary:</p>
  
  <pre><code>// address dictionary properties
  
  @property (nonatomic, readonly) NSString *name; // eg. Apple Inc.
  
  @property (nonatomic, readonly) NSString *thoroughfare; // street address, eg. 1 Infinite Loop
  
  @property (nonatomic, readonly) NSString *subThoroughfare; // eg. 1
  
  @property (nonatomic, readonly) NSString *locality; // city, eg. Cupertino
  
  @property (nonatomic, readonly) NSString *subLocality; // neighborhood, common name, eg. Mission District
  
  @property (nonatomic, readonly) NSString *administrativeArea; // state, eg. CA
  
  @property (nonatomic, readonly) NSString *subAdministrativeArea; // county, eg. Santa Clara
  
  @property (nonatomic, readonly) NSString *postalCode; // zip code, eg. 95014
  
  @property (nonatomic, readonly) NSString *ISOcountryCode; // eg. US
  
  @property (nonatomic, readonly) NSString *country; // eg. United States
  
  @property (nonatomic, readonly) NSString *inlandWater; // eg. Lake Tahoe
  
  @property (nonatomic, readonly) NSString *ocean; // eg. Pacific Ocean
  
  @property (nonatomic, readonly) NSArray *areasOfInterest; // eg. Golden Gate Park
  </code></pre>
  
  <p>So, I create a dictionary and then pass it like so:</p>
  
  <pre><code>return [[[MKPlacemark alloc] initWithCoordinate:aLocation.coordinate addressDictionary:addressDictionary] autorelease];
  </code></pre>
  
  <p>Unfortunately, after all that, introspection shows that the information did not stick:</p>
  
  <pre><code>NSLog(@"placemark %@ from %@", placemark, addressDictionary);
  NSLog(@"has %@", placemark.thoroughfare);
  </code></pre>
  
  <p>Prints</p>
  
  <pre><code>2012-01-31 20:14:22.545 [15450:1403] placemark &lt;+___,-___&gt; +/- 0.00m from {
  administrativeArea = __;
  postalCode = _____;
  subAdministrativeArea = ___;
  subThoroughfare = __;
  thoroughfare = "_____";
  }
  2012-01-31 20:14:22.545[15450:1403] has (null)
  </code></pre>
  
  <h2><em>Conclusion</em></h2>
  
  <p>So, I'm about at the end here.  Has anyone figured out how to create your own MKPlacemark?  Thanks.</p>