Skip to content
This repository has been archived by the owner on Jun 9, 2018. It is now read-only.
Clayton Burlison edited this page Feb 19, 2016 · 18 revisions

Sorry for the dump of information. It will be organized soon.

###Google Geocoding API We are using Google's Geocoding API for reverse address lookup. This API comes with the following limits:

  • 2,500 free requests per day
  • 10 requests per second

Additional information can be found: https://developers.google.com/maps/documentation/geocoding/usage-limits

###CoreLocation CoreLocation requires a wireless adapter to obtain lookup information. On older Macs that did not ship with a wireless adapter this script will exit without enabling Location Services or authorizing Python for lookups. If your Mac has the wireless card disabled there is a chance that this script will still obtain a location based off of CoreLocation's cached data. Your Mac does not need to be connected to an active SSID for location data to be found just enabled.

Of interest:

Your approximate location is determined using information from local Wi-Fi networks, and is collected by Location Services in a manner that doesn’t personally identify you.

-- https://support.apple.com/en-us/HT204690

##Settings

The call out to Google's API can be disabled if you wish. If you disable this api call the only data provided to MunkiReport will be client side data from CoreLocation: Latitude, Longitude, Accuracy, and Altitude.

Disable Google API loopups:

sudo defaults write /Library/Preferences/MunkiReport ReportPrefs -dict-add location_address_lookup -bool False

Enable Google API lookups (default):

sudo defaults write /Library/Preferences/MunkiReport ReportPrefs -dict-add location_address_lookup -bool True

This can also be disabled with a profile. Example: @clburlison/profiles.

##Errors

Error message Meaning
Your OS is not supported at this time Your OS is either too old or possibly too new for this script.
Location Services was enabled. Please wait 30 seconds before doing a lookup This status message should only be seen on the first run of this script. We need to wait 30 seconds before doing a lookup.
No wireless interface found Without a wireless interface we cannot find geodata.
Unsuccessful: Unable to locate CoreLocation was unable to locate your Mac. Apple Error Code: 3
Unsuccessful: Denied CoreLocation was denied access to location service. Apple Error Code: 2
Unsuccessful: Restricted CoreLocation obtained restricted access to location services. Apple Error Code: 1
Unsuccessful: Not Determined CoreLocation could not determine a geolocation. Apple Error Code: 0
Unsuccessful: Location Services Disabled Location Services is disabled. This is often due to your AirPort card being turned off.
Error obtaining a location. LS was unresponsive or a lookup timeout occurred. General Error. Location services failed to find a location for one or more reasons.

##Testing In most cases the warnings produced by this script in a normal run will provide enough information to determine what the issue is. However, if you are unsure why a lookup is failing the best way to get more information is with the verbose output option.

To see warnings and information use:

sudo /usr/local/munki/preflight.d/location.py -v

To see a full output of warnings, information, and debug statements use:

sudo /usr/local/munki/preflight.d/location.py -vv

##Database entries

The following data is created by this script and can be accessed via MunkiReports API:

  • Address - Str, Estimated street address
  • Latitude - Str, Latitude
  • Longitude - Str, Longitude
  • LatitudeAccuracy - Int, Latitude Accuracy
  • LongitudeAccuracy - Int, Longitude Accuracy
  • Altitude - Int, Altitude
  • GoogleMap - Str, Pre-populated Google Maps URL
  • LastRun - Str, Last run time stored in UTC time
  • CurrentStatus - Str, Friendly message describing last run
  • LS_Enabled - Bool, are Location Services enabled.
Clone this wiki locally