How to sort a list of locations by how close they are to you

One of the things that are most important to me for phase 1 of the state parks app is to have the list of parks be sorted by how far the user is from the park.  After all, Tower Hill State Park might be interesting but if you live 4 hours away, you aren’t likely …

Continue reading "How to sort a list of locations by how close they are to you"

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.

See the Pen
HTML5 Geolocation (how to get a street address)
by Joe Steinbring (@steinbring)
on CodePen.

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.