Last active
November 16, 2017 15:39
-
-
Save echjordan/342feec2325660312d184aae0cba9f31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//PAYPHONES.JS | |
import fetchPayphones from './payphonesFetch' | |
export function putPhoneData() { | |
const data = fetchPayphones() | |
//Narrow results by latitude and longitude | |
let filteredData = data.filter((result) => { | |
const lat = result[9].slice(25, 41) | |
const long = result[9].slice(7, 23) | |
return (lat < 40.76 && lat > 40.74) && (long > -74 && long < -73.99) | |
}) | |
// Loop through the results array and create a google maps coordinate with each lat and long, | |
// store that result in an array | |
filteredData.forEach(elem =>{ | |
let payphoneData = [] | |
let coords = [elem[9].slice(25, 41), elem[9].slice(7, 23)] | |
const latLng = new google.maps.LatLng(coords[0], coords[1]); | |
payphoneData.push(latLng) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment