Maps

The Maps service searches places and converts addresses to and from coordinates with Apple Maps. Access it via app.maps. It needs the network but not the location permission.

for place in app.maps.search("coffee", near=(45.4642, 9.19)):
    print(place.name, place.address)

duomo = app.maps.geocode("Piazza del Duomo, Milano")[0]
nib.Map(latitude=duomo.latitude, longitude=duomo.longitude)

Methods

search(query, near=None, radius=5000, limit=10, timeout=20.0)

Places matching a query, as in the Maps search field.

Parameter Type Description
query str What to look for: "coffee", "pharmacy", a name or an address
near tuple[float, float] (latitude, longitude) to search around. Apple Maps picks a region by default
radius float Meters around near to prefer
limit int At most this many places
timeout float Seconds to wait for Apple Maps

geocode(address, timeout=20.0)

The places an address may refer to, best match first.

reverse_geocode(latitude, longitude, timeout=20.0)

The address at a point, or None.

Nothing found gives an empty list or None, not an error. A network failure raises nib.ServiceError.

Place

Field Description
name The place's name, or the address for a plain address
latitude, longitude Where it is
address The full postal address on one line
street, city, postal_code, region, country, country_code Its parts; country_code is ISO 3166, such as "IT"
phone, url For a business, when Apple Maps has them
category For a point of interest, such as "Cafe" or "Restaurant"

Names and addresses follow the system language.