iOS Reference Library Apple Developer
Search

MKPlacemark Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/MapKit.framework
Availability
Available in iOS 3.0 and later.
Declared in
MKPlacemark.h

Overview

A MKPlacemark object stores placemark data for a given latitude and longitude. Placemark data includes information such as the country, state, city, and street address associated with the specified coordinate. Placemark objects are typically generated by a MKReverseGeocoder object, although you can also create them explicitly yourself.

A placemark is also an annotation and conforms to the MKAnnotation protocol, whose properties and methods include the placemark coordinate and other information. Because they are annotations, you can add them directly to the map view.

Important: The MapKit framework uses Google services to provide map data. Use of this class and the associated interfaces binds you to the Google Maps/Google Earth API terms of service. You can find these terms of service at http://code.google.com/apis/maps/iphone/terms.html.

Tasks

Initializing a Placemark Object

Accessing the Placemark Attributes

Properties

For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.

addressDictionary

A dictionary containing the Address Book keys and values for the placemark. (read-only)

@property (nonatomic, readonly) NSDictionary *addressDictionary

Discussion

The keys in this dictionary are those defined by the Address Book framework and used to access address information for a person. For a list of the strings that might be in this dictionary, see the “Address Property” constants in ABPerson Reference.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h

administrativeArea

The state associated with the placemark. (read-only)

@property (nonatomic, readonly) NSString *administrativeArea

Discussion

If the placemark location was Apple’s headquarters, the value for this property would be the string “CA” or “California”.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h

country

The name of the country associated with the placemark. (read-only)

@property (nonatomic, readonly) NSString *country

Discussion

If the placemark location was Apple’s headquarters, the value for this property would be the string “United States”.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h

countryCode

The abbreviated country name. (read-only)

@property (nonatomic, readonly) NSString *countryCode

Discussion

This string is the standard abbreviation used to refer to the country. For example, if the placemark location was Apple’s headquarters, the value for this property would be the string “US”.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h

locality

The city associated with the placemark. (read-only)

@property (nonatomic, readonly) NSString *locality

Discussion

If the placemark location was Apple’s headquarters, the value for this property would be the string “Cupertino”.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h

postalCode

The postal code associated with the placemark. (read-only)

@property (nonatomic, readonly) NSString *postalCode

Discussion

If the placemark location was Apple’s headquarters, the value for this property would be the string “95014”.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h

subAdministrativeArea

Additional administrative area information for the placemark. (read-only)

@property (nonatomic, readonly) NSString *subAdministrativeArea

Discussion

Subadministrative areas typically correspond to counties or other regions that are then organized into a larger administrative area or state. For example, if the placemark location was Apple’s headquarters, the value for this property would be the string “Santa Clara”, which is the county in California that contains the city of Cupertino.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h

subLocality

Additional city-level information for the placemark. (read-only)

@property (nonatomic, readonly) NSString *subLocality

Discussion

This property contains additional information, such as the name of the neighborhood or landmark associated with the placemark. It might also refer to a common name that is associated with the location.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h

subThoroughfare

Additional street-level information for the placemark. (read-only)

@property (nonatomic, readonly) NSString *subThoroughfare

Discussion

Subthroughfares provide information such as the street number for the location. For example, if the placemark location was Apple’s headquarters (1 Infinite Loop), the value for this property would be the string “1”.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h

thoroughfare

The street address associated with the placemark. (read-only)

@property (nonatomic, readonly) NSString *thoroughfare

Discussion

The street address contains the street name. For example, if the placemark location was Apple’s headquarters, the value for this property would be the string “Infinite Loop”.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h

Instance Methods

initWithCoordinate:addressDictionary:

Initializes and returns a placemark object using the specified coordinate and Address Book dictionary.

- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate addressDictionary:(NSDictionary *)addressDictionary

Parameters
coordinate

The map coordinate to associate with the placemark.

addressDictionary

A dictionary containing keys and values from an Address Book record. 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.

Return Value

An initialized MKPlacemark object.

Discussion

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.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h



Last updated: 2009-07-23

Did this document help you? Yes It's good, but... Not helpful...