Implement geolocation API

Fixes #464.