Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div id="app">
	<table v-if="!loading">
			<th>Property Type</th>
			<th>Physical Address</th>
			<th v-if="this.sortedParks[0].distance > -1">Distance From You</th>
		<tr v-for="park in this.sortedParks">
			<td v-if="park.statePark == 'TRUE'">State Park</td></span>
			<td v-if="park.recreationArea == 'TRUE'">Recreation Area</td>
			<td v-if="park.stateForest == 'TRUE'">State Forest</td>
			<td v-if="park.distance > -1">{{park.distance.toFixed(2)}} km</td>

	<div v-if="loading">
		Loading ...	
		<div v-if="loadingMessages !=''">
			Error: {{loadingMessages}}




                new Vue({
  el: "#app",
  data() {
    return {
			location: {'street':'','adminArea5':'','adminArea3':'','postalCode':''},
			parks: [],
			loading: true,
			loadingMessages: ''
	methods: {
		getDistanceFromLatLonInKm: function(lat1,lon1,lat2,lon2) {
			var R = 6371; // Radius of the earth in km
			var dLat = this.deg2rad(lat2-lat1);  // deg2rad below
			var dLon = this.deg2rad(lon2-lon1); 
			var a = 
				Math.sin(dLat/2) * Math.sin(dLat/2) +
				Math.cos(this.deg2rad(lat1)) * Math.cos(this.deg2rad(lat2)) * 
				Math.sin(dLon/2) * Math.sin(dLon/2)
			var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
			var d = R * c; // Distance in km
			return d;
		deg2rad: function(deg) {
			return deg * (Math.PI/180)
		geolocation: function() {
      if (navigator.geolocation) {
			} else {
				console.log("Geolocation is not supported by this browser.");
		showPosition: function(position) {
			// Use Axios to make a MapQuest API Call
					.then(response=> (this.location =[0].locations[0]));
  mounted() {
		try{	axios.get("").then(response=> (this.parks =;
				 this.loadingMessages = 'Error loading parks data';
	watch: {
		location: function(){
			// Loop over the parks
			for (let i in this.parks) {
				// Set the distance value in km
				this.parks[i].distance = this.getDistanceFromLatLonInKm(this.parks[i].LatLongCoordinates.split(',')[0],this.parks[i].LatLongCoordinates.split(',')[1],,this.location.latLng.lng);
		parks: function () {
			// Check to see if we have distances to the parks, yet
			if(this.parks.length > 0){
				this.loading = false;
	computed: {
		// This new computed value is how we are going to sort the parks by how far they are from the user
		sortedParks: function() {
			// Temporary hold for 'this'
			var globalScope = this;

			function compare(a, b) {
				if (a.distance < b.distance)
					return -1;
				if (a.distance > b.distance)
					return 1;
				return 0;
			return this.parks.sort(compare);