DEV Community

Joe Steinbring
Joe Steinbring

Posted on • Originally published at blog.jws.app on

2 1

How to get the user’s street address, using navigator.geolocation and MapQuest

Let’s say that you have a webform where you are collecting a user’s street address. You can save the user a few minutes by defaulting the value for them. In this example, we are using Vue.js, Axios, a MapQuest API, and navigator.geolocation to first get the latitude and longitude from the client and then send it off to MapQuest to get a physical address.

This example builds off of our earlier Axios / Vue.js 2 APIs 101 post. But you will notice that there is a methods property, now. The this.geolocation() function is then kicked off within mounted().

Have a question or comment? Drop it in the comments and I will try to help.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more